views:

146

answers:

3

I want to extract the latitude and longitude of a set of about 50-100 pins in a Google maps web page. I don't control the page and I don't need to do it more than once so I'm looking for something quick and dirty. I've got FireFox with FireBug as well as Chrome and all I need is something that's easier than re typing all the numbers.

+2  A: 

Just saving the .html file and using regex works:

These two reg-ex might be good starting points:

@[0-9]+\.[0-9]+,-[0-9]+.[0-9]+",geocode:"",sxti:"[-@A-Za-z .]+"
{id:"[A-Zloc0-9]+",fid
BCS
A: 

Depending on the type of the map and whether the pins are set by latitude and longitude or by address, it might even work to just get the link (click on "Link" at the Google Maps page, the URL in the browser might not be the sam) and look for the "sll=[...]" parameters.

Dominik
OK, now how do I extract the links? Keep in mind I had more than can be easily done by hand.
BCS
Which links? I thought you wanted the latitude/longitude.
Dominik
+3  A: 

Simply click the link shortcut on the map to retreive a URL for the map with pins in.

Next add &output=kml to the end of this url and use the link to retrieve a kml file containing all the pin data.

This kml file is actually in xml format so parsing it should be easy, you just need to look for <coordinates> elements which contain the latitude and longitude data you need.

The kml format is documented here: http://code.google.com/apis/kml/documentation/kmlreference.html

FixerMark
a simple regex to extract the coordinates would be <coordinates>.*</coordinates>
FixerMark