Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract the lat/lng of pins in google maps?

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.

like image 610
BCS Avatar asked Apr 01 '10 03:04

BCS


People also ask

Can I export pins from Google Maps?

Use Google Takeout takeout.google.com/settings/takeout to export your saved/starred locations.

How do I get GPS coordinates from a dropped pin?

To obtain coordinates for a location on Android, you'll drop a pin. Tap and hold a spot on the map. You'll see a red pin appear on the map and a Dropped Pin window at the bottom. The coordinates for the pinned location appear in the Search box at the top.


2 Answers

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

like image 104
FixerMark Avatar answered Oct 04 '22 02:10

FixerMark


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
like image 45
BCS Avatar answered Oct 04 '22 02:10

BCS