开发者

Google Maps HTTP API for driving and walking directions

Do you know how I can get walking directions from Google by giving two specific coordinates? How can I send simple HTTP GET requ开发者_如何学编程ests 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/


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:

  • Getting distance using GDirections via URL
  • Calculate driving directions using PHP?
  • Retrieve driving directions from google maps with server-side HTTP calls and show results with static maps for WAP
  • Google Maps and Directions, REST Interface?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜