如何创建带有方向的静态 api 地图 [英] how to create a static api map with directions
本文介绍了如何创建带有方向的静态 api 地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试构建一个静态谷歌地图,其中包含从宾夕法尼亚州维拉诺瓦到宾夕法尼亚州德文的路线.我也生成了一个 google api 密钥,但我无法构建 url.能否给我一个示例网址,以便我了解它的情况并构建新网址.
谢谢
解决方案
看这里:
I am trying to build a static google map with directions from villanova,pa to devon, pa. I have generated a google api key also and I am not able to build the url. can you please give me a sample url so that i can see how it is and build the new ones.
thanks
解决方案
look here: Google Maps API Doc
Basically the flow is: 1) you ask for Directions (via Directions API) 2) in the XML/JSon result, you'll find a tag like this:
<overview_polyline>
<points> a lot of chars here.. </points>
</overview_polyline>
3) you ask for Static Map specifying in the url the param:
path=enc:<the lot of chars you got in (2) >
This is a sample image:
这篇关于如何创建带有方向的静态 api 地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文