· Introduction
A number of people want to export their data from "My Maps", and Google provide a KML export. However there is a common gotcha when attempting it, so thought would post it here.
(Note that since this page was first published, Google have added a direct KML link to the download, so its much easier now!)
· Restrictions
There are however a number of limitations with the export:
- 'Snap to Roads' lines; the export only includes the user entered points, not the actual road following line.
- 'Search Results' - Results saved to "My Maps" via the 'Save to' feature - only export the title, not the description
View your map, and the click the "KML" link. This link downloads the actual data - whoop!
(Don't use the icon - that only downloads a link - see below)
The icon rightly produces a KML file, which when loaded up in Google Earth displays your map, great! However this KML file you download is a "Network Link" or pointer to another URL. This is done so that as you update the map on Google Maps, Google Earth can actully refetch the content so that changes are visible. But this makes the KML file not very useful for getting the actual data. If you view the file it looks something like this: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.2"> <name>Example points in UK</name> <description><![CDATA[]]></description> <name>Example points in UK</name> <href>http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&oe=UTF8&msa=0&msid=103387750622659154041.00045e6c12a1cc165d6ee&output=kml</href> And there is the link, which notice contains output=kml - to get the actual data. Google Earth knows to follow the network link to get the content, and now you do too! , notice in the URL the &'s, because the above file is actully XML the & in the url needs to be entity encoded, so if copy/pasting (or scripting!) you need to make sure you also decode. A XML parser might do it for you but you still might need to do it, in PHP html_entity_decode is useful. So the above link actually becomes: http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&oe=UTF8&msa=0&msid=103387750622659154041.00045e6c12a1cc165d6ee&output=kml (which is just a slight variation on the link you get if you just change the 'View in Google Earth' url, mentioned in the shortcut)
This feature is no longer available
|
|