用于驾驶和步行方向的 Google 地图 HTTP API

发布于 2024-08-17 03:12:42 字数 308 浏览 5 评论 0原文

你知道如何通过给出两个具体坐标从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

满意归宿 2024-08-24 03:12:42

目前没有经过记录和批准的方法来通过 HTTP 请求访问 Google Maps Directions API(更新:Google 添加了步行和驾车 通过网络服务的路线,2010 年 5 月)。

然而,返回 JSON 输出的未记录方法如下:

http://maps.google.com/maps/nav?q=from:London%20to:Dover

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:

http://maps.google.com/maps/nav?q=from:London%20to:Dover

The format of the q parameter should be from: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:

两相知 2024-08-24 03:12:42

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文