views:

268

answers:

3

Hello all,

Is there any way to get the geo coordinates for a driving direction from google maps API?

if we use URL to show the driving direction with source and destination address we'll get the map and route as an webpage, instead of that i like to get the co-ordinates and details in some xml like format.

A: 

The Google API documentation has a section on XML requests and parsing. It's quite detailed, many options available.

Argalatyr
+2  A: 

Sure, see the docs. You make a GDirections object (without a div AND without a map so nothing will be displayed by default and you'll handle all the displaying), and call its load method, specifying getPolyline and getSteps as both true (so you'll get the polyline and the textual directions despite the lack of div and map).

The GDirections' object load event fires when the results are ready. Then you use getPolyline, getNumRoutes, and getRoute methods on the object to retrieve results.

As a full reference, also check this (both GDirections and GDirectionsOptions)...!

Alex Martelli
A: 

Hai all,
Finally i got the solution, google also provides the driving directions in JSON format, we can parse the JSON data and that will give all the details including coordinates, name, description, distance and approximate time

example:

http://maps.google.com/maps/nav?key=YOUR-MAP-KEY&output=json&q=from%3AsourceAddress to: destinationAddress

Thank you all for the support

shinto Joseph