Getting coordinates and names for a route

Is there a way to get geocoordinates for heading from Google Maps API?

if we use a url to show the direction of travel with source and destination, we get the map and route as a web page, instead I like to get the coordinates and details in some XML format.

+2


source to share


3 answers


Hi everyone,
Finally I got the solution, google also provides driving directions in JSON format, we can parse the JSON data and this 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:sourceAddress in: destinationAddress

Thank you all for your support

0


source


Of course see the docs . You create a GDirections object (no div

AND without map

, so nothing will be displayed by default and you will handle all of the display) and call its method load

specifying getPolyline

and getSteps

as true (so you get polyline and text directions despite no div and map) ...

The load

GDirections object event fires when the results are ready. Then you use methods getPolyline

, getNumRoutes

and getRoute

on the object to get the results.



For a complete reference also check out this (both GDirections and GDirectionsOptions) ...!

+3


source


The Google API documentation has a section on XML queries and parsing . It's quite detailed, there are a lot of options available.

0


source







All Articles