Is it possible to get Google Maps Directions using HTTP requests?
Asked Answered
K

8

7

Is it possible to use the Google Maps API router just using HTTP? Something like http://maps.google.com?from=blah?to=blah

And have it return some sort of XML or JSON representing the directions?

Kingfish answered 23/12, 2009 at 19:32 Comment(0)
B
3

Actually yes, and they do it themselves

The REST format is like:

http://maps.google.com/maps/nav?output=js&q=from:%20Montreal%20to:%20Toronto&key=apikey

Where q should have the form: "from: x to: y" (url encoded).

Some of the parameters are similar to the HTTP Geocoding service: http://code.google.com/apis/maps/documentation/geocoding/index.html

Mike

Berniecebernier answered 27/12, 2009 at 6:24 Comment(0)
C
3

There is no documented and approved method to access driving directions via an HTTP API request.

This makes it difficult to get driving directions on the server-side, which I assume is your intention.

Not only it is undocumented and difficult to achieve, but it would also violate the restrictions 10.1 and 10.5 of the Google Maps API Terms and Conditions.

However, if you don't mind the challenge, and you believe that rules are there to be broken, you may want to check these articles:

Cheerless answered 23/12, 2009 at 20:6 Comment(0)
C
3

If you want Google to allow legal access to driving directions via HTTP you might consider voting for the enhancement request: Issue 235. Theoretically, the more people that vote for an enhancement request, the more attention Google give to it.

However, I strongly suspect that there might be contractual issues with the organisations that supply the data. Organisations like TeleAtlas impose restrictions about how Google can use their data. TeleAtlas probably don't want Google to make it legal for people to use their data to create apps for free that directly compete with their own commercial apps and devices.

Coriolanus answered 24/12, 2009 at 10:35 Comment(0)
B
3

Actually yes, and they do it themselves

The REST format is like:

http://maps.google.com/maps/nav?output=js&q=from:%20Montreal%20to:%20Toronto&key=apikey

Where q should have the form: "from: x to: y" (url encoded).

Some of the parameters are similar to the HTTP Geocoding service: http://code.google.com/apis/maps/documentation/geocoding/index.html

Mike

Berniecebernier answered 27/12, 2009 at 6:24 Comment(0)
T
1

Here you can find a list of parameters you can pass to the maps.google.com URL. Maybe you'll be able to get the information you need. I don't know what the returned output contains. At least you are able to define different output types.

Tippett answered 23/12, 2009 at 19:48 Comment(0)
L
1

I have already used this library with python and it works well, although it's against Google Maps API Terms.

Levy answered 23/12, 2009 at 20:11 Comment(0)
O
1

API v3 (made the official version in the last six months), does:

http://code.google.com/apis/maps/documentation/directions/

Also note that most of the competing services (Bing Maps, Yahoo, MapQuest, CloudMade, etc) also support RESTful web services along these lines.

As always with these services, check the Terms & Conditions.

Osmund answered 11/1, 2011 at 17:21 Comment(0)
I
0

I've never used the API but it is pretty easy to get the structured directions data from a google maps page using JS to access the gmap page's DOM.

Iceboat answered 23/12, 2009 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.