There is no documented and approved method at the moment to access the Google Maps Directions API via an HTTP request (update: Google added 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: