An article on Ogle Earth alerts us to a neat trick to get a location from Google Maps to Google Earth. Simply add ‘&output=kml’ to the URL of the map you are viewing, (be sure to click the ‘Link to this page’ on the map first!). I created this simple javascript gMaps2kml bookmarklet, that seems to do the trick, so drag it to your bookmark bar and enjoy*.
Unfortunately, I have problems with getting this to work in Firefox (1.5) whether I use the bookmarklet or manually paste the parameter. It always generates the same kml file of a location in New York. Safari, Opera and Camino don’t have this problem! I’ll have to keep you posted of this one. A friend with a similar setup doesn’t have the same problem – might be a firefox extension issue.
* Note: that the resulting kml files are simply called ‘maps’ with no extension, so this may cause you grief, but it’s easily fixed by adding the extension.
Update: Barry Hunter over at nearby.org.uk, who originally documented the hack, has improved on my bookmarklet, by searching the DOM for the ‘link’, so you don’t have to click ‘Link to this Page’ anymore. He’s posted it in a comment below, but I’ll put it here as well. gMaps2kml2. Isn’t that neat?
Nice.
The first thing I thought after reading the ‘&output=kml’ tip was a bookmarklet. But seeing that I don’t know anything about Java, it was a matter of waiting for someone to do it.
Now your bookmarklet lives in my bookmark bar. Thanks.
For what it’s worth it works fine on Google Maps UK on my Firefox 1.5 installation (on my Mac). Thanks! Doesn’t work with Google Maps France though.
Oops – I tell a lie – it *does* work for Google Maps France. I just forgot to click on the “get the URL” link first!
That’s such a cool idea! If interested I have extended it slightly to work without having to click the ‘link to this map link’ first, as it tries to read the url direct from there! Hoping that it will let me post a javascript link here: gMaps2kml2 [tested in IE and firefox] (if it doesn’t work will add it as an update to my blog)
Seems it didn’t like the javascript in a link, if you can’t correct it then its posted here.
Barry, you got in ahead of me! I was going to have a go at getting the URL directly from the link when I found a spare half hour. Well done! your link now replaces mine on my toolbar!
An additional tip explained here lets you open any location in any Google-maps-based mashup with Google Earth. No need for that with Tagzania as all our pages have KML, but useful for things that you may find elsewhere, a crime spot in Chicagcrime.org, a nice house in Housingmaps.com…
The set of Tagzania bookmarklets for different sites (Multimap, Yahoo Maps Beta…) could also be adapted for direct KML downloading