用于驾驶和步行方向的 Google 地图 HTTP API
你知道如何通过给出两个具体坐标从 Google 获取步行路线吗? 如何发送简单的 HTTP GET 请求并将结果保存在 KML 文件中?
我不想进行地理编码,而是获取此方法返回的 KML 文件形式的行车路线:
http://www.gringod.com/2008/02/26/save-google-maps-drive-directions/
Do you know how I can get walking directions from Google by giving two specific coordinates?
How can I send simple HTTP GET requests and have the result in a KML file?
I don't want to geocode, but get the driving directions as the KML file returned by this method:
http://www.gringod.com/2008/02/26/save-google-maps-driving-directions/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前没有经过记录和批准的方法来通过 HTTP 请求访问 Google Maps Directions API(更新:Google 添加了步行和驾车 通过网络服务的路线,2010 年 5 月)。
然而,返回 JSON 输出的未记录方法如下:
q
参数的格式应为from:xxx%20to:yyy
。将 xxx 和 yyy 分别替换为起点和目的地。您可以使用纬度和经度来代替完整地址。默认情况下,此请求返回行车路线。要获取步行方向,您可以将可选参数
dirflg=w
添加到查询字符串中。 (来源)请注意,这不仅没有记录,而且还可能违反Google Maps API 条款及条件的限制 10.1 和 10.5。
您可能还有兴趣查看以下文章:
There is no documented and approved method at the moment to access the Google Maps Directions API via an HTTP request (update: Google added walking and driving directions via web services in May, 2010).
Nevertheless, an undocumented method that returns a JSON output is the following:
The format of the
q
parameter should befrom:xxx%20to:yyy
. Replace xxx and yyy with the start and destination respectively. You can use a latitude and a longitude instead of full addresses.By default this request returns driving directions. To get walking directions you can add the optional parameter
dirflg=w
to the query-string. (Source)Note that not only this is undocumented, but it may also violate the restrictions 10.1 and 10.5 of the Google Maps API Terms and Conditions.
You may also be interesting in checking out the following articles:
Google 于 2010 年 5 月通过网络服务添加了路线:
http://code.google。 com/apis/maps/documentation/directions/
路线以 XML 或 JSON 格式返回。
他们还提供地理编码、海拔和可用地点。
Google added directions via web services in May, 2010:
http://code.google.com/apis/maps/documentation/directions/
Directions are returned in either XML or JSON format.
They also have geocoding, elevation, and places available.