views:

72

answers:

2

I want to draw a route in google map with desites A & B directions specidied,I am able to do this through google directs ,thanks to goole..No i want to create a static map with only that route and hence i need to get all the latitude and longitude details into CSV for 100M distance of this route.

Is there any possible way as currently i need to place a marker at every distance and copy the co-ordinates manually from map which is very tedious when i need to do this from 100KM + ,

Any help provided is truely appreciated.

+1  A: 

If you are getting the directions via the Javascript directions API, the following can all be done programmatically, but I am assuming you are getting your directions from the maps.google.com page? If so then you can get the KML associated with the directions response via My Maps.

After you make your directions request you need to go to the bottom of the text directions and select Save to My Maps. This will add the directions to your My Maps page (assuming you are logged into a google account). Go to My Maps and select the entry you just added. Click the edit button on the left. This will expose a View in Google Earth link on the top right of the map. Clicking this link will download a file that looks like this:

<?xml version="1.0" encoding="UTF-8"?>    
<kml xmlns="http://earth.google.com/kml/2.2"&gt;
<Document>
<name>Directions to Scone, NSW</name>
<description><![CDATA[]]></description>
    <NetworkLink>
    <name>Directions to Scone, NSW</name>
    <Link>
    <href>http://maps.google.com/maps/ms?ie=UTF8&amp;amp;hl=en&amp;amp;vps=1&amp;amp;jsv=262a&amp;amp;oe=UTF8&amp;amp;msa=0&amp;amp;msid=109115301202341389527.00048cf92603b4141b1cf&amp;amp;output=kml&lt;/href&gt;
    </Link>
    </NetworkLink>
</Document>
</kml>

Replace all the escaped &amp; with & in the URL in the href element and request the URL in the browser. This will give you the KML that you are after:

http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;vps=1&amp;jsv=262a&amp;oe=UTF8&amp;msa=0&amp;msid=109115301202341389527.00048cf92603b4141b1cf&amp;output=kml
Cannonade
iSharreth
@iSharreth You might have missed one. See my edit above, I have included a link to the KML based on my request. N.B. You wont get a CSV file from this link, you will get a KML file (XML) with the raw location data it in. You will need to do some processing on that file to strip out everything except the latitudes and longitudes.
Cannonade
It worked!!! Thanks so much!!!!
iSharreth
@iSharreth Glad to hear it :)
Cannonade
A: 

Not sure if this can be helpful but if you are using googles rest service to get the data have a look at this.

Pranali Desai