Google Maps 2 Google Earth — now scalable

A great hint from‘s Barry Hunter on Google Earth Community: You can append “&output=kml” to any Google Maps URL to have Google return a placemark in a KML file that opens automatically in Google Earth. This appears to be an undocumented feature — Google Maps’ API pages don’t appear to have it.

For example, here where I live in Stockholm, more or less, in Google Maps.

That’s using the URL you get by clicking on “Link to this page” in Maps. Now here is where I live in Stockholm in Google Earth.

Barry’s suggested query format in his hint returns a more verbose page in Google Maps.

And if you append “&output=kml”, the KML returned is also more descriptive with a link back to the Maps version.

Experimenting a little, it turns out that by using Barry’s format, you can have Google Earth fly to any address or place name its database knows. For example, Berlin, Germany in Maps (look, no coordinates). Berlin, Germany in Google Earth (again, no coordinates).

I haven’t found a way to encode views in a query, so your Google Earth view is always from above.

What’s so new about this? Generating KML from a server query has certainly been done before — in fact, it was Ogle Earth’s very first mashup, back in July 2005 (direct link. You can also use it via yubnub.) The problem with running PHP off is that it is not exactly scalable if everybody uses it. But appending “&output=kml” to Google Maps is.

Finally, the caveats: This method also still pollutes your desktop/download area with KML files, and it isn’t a “transparent” solution, in the sense that we’re mixing magisteria here, piggybacking on web protocols to get to Google Earth’s coordinate space. But it’s the closest yet to linking seamlessly from the web to Google Earth.

[Update 2006-04-25: Barry tells how he found this hack.]

[Update 2006-05-07: The hack gets its own javascript bookmarklet over here.]

19 thoughts on “Google Maps 2 Google Earth — now scalable”

  1. Yeah. I just can’t figure out why Google doesn’t allow a feature to show a “Fly to” (using GE) button on Google Maps if you have GE installed. Someone should write a real quick Firefox extension for GE users to do this. Barry?

  2. That’s a great find. This makes me so happy.

    It should be noted (at least in my experience) that the KML file generated is always named “maps” and lacks the KML extension following the name.

    Is there an article or technique that can do the reverse: turn a KML/KMZ file into a google map with all the locations viewed on Google Earth.

  3. I’m having mixed success on my mac. It works find in all my mac browsers except Firefox, which always throws up the same kml location in NY City.

    I created a simple javascript bookmarklet, but the spam filter won’t let me include it here as a link, so you’ll have to visit my blog at

  4. Woowoowoo,

    I’m away from my Mac right now, but on a hunch, have you tried downloading the latest version of the Mac client released a few days ago? I will test this later tonight.

  5. It doesn’t work for me (Firefox on PC)

    I get a KML file but it’s always the zipcode in my city, nothing more.

    It must be a GE setting. I hope someone figures it out.

  6. Jim, make sure you’ve clicked on “link to this page first” if you’re doing it manually instead of with the bookmarklet.

  7. I tried the exact steps but it didn’t work for me either. Firefox on PC. I always get my default location.

    Later I entered the my search query and tried again then it worked.

    You have to search for the location then click ‘Link to this page’ button. Then add &output=kml to the URL.

  8. When you had set a position as a default location f.e. in firefox this method doesn’t work. Clear your google-cookies (or all) and it works.

  9. When you had set a position as a default location f.e. in firefox this method doesn’t work. Clear your google-cookies (or all) and it works.

  10. Very nice finding there!

    Your Stockholm link worked like a breeze for me, under the following circumstances and actions:

    I use Firefox 1.5 on Win XP and have the latest GE 4.0 beta installed.

    Clicking on the link to your Google Maps position takes me to GM, as expected. I then click “link to this page. In the FF address field I add ‘&output=kml’ and press enter.

    I’m offered to download the KML file and select to “open in Google Earth”, which I do.

    GE starts, loads the KML file and takes me to your position on GE. Your area is shown at a slightly different scale.

  11. I just made a javascript bookmarklet that will automatically append “&output=kml” to the end of whatever url you are browsing at the time. enjoy!

    create new firefox bookmark on your toolbar and put this code as the location:


Comments are closed.