Google Maps in Google Earth

Following on from our post on Google Earth’s internal browser we are exploring what can be done within placemarks in Google Earth.

A very underutilized feature of network links is the ability to send the location that the user is looking at as part of the URL. We thought it would be fun to demonstrate this capability by displaying a Google Map of the location you are looking at in a placemark. If you are a programmer wanting to learn more, see this tutorial from Google.

In order to make it work, the network link must point to a server that takes the URL parameters and dynamically returns a KML file that takes into account the location the user is looking at. This means this effect cannot be achieved without an application server. This might explain why the feature is so rarely used.

We set up a free cloud based server on OpenShift using an application called Node.js, which lets you run JavaScript on the server. Although it took a little time to get right, the result is only about 10 lines of code (beyond the provided template) on the server and a few more in the KML file.

To try it out, simply download this KML file and open it in Google Earth. Whenever you move the view it will move the placemark to approximately the centre of the Screen and show you a Google Map of the area.

Note that it is a fully working embedded Google Map, including the ability to zoom in and out, switch to satellite imagery or use Street View.

About Timothy Whitehead

Timothy has been using Google Earth since 2004 when it was still called Keyhole before it was renamed Google Earth in 2005 and has been a huge fan ever since. He is a programmer working for Red Wing Aerobatx and lives in Cape Town, South Africa.






PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.

Comments

  1. Interesting and a bit of work too. If the embedded map would remain centered on the placemark as you zoomed in, it would be more useful. Total overlaying the Google Maps makes it a lot more useful such as you’ll find at: http://ge-map-overlays.appspot.com

    One thing Google Earth doesn’t do is include river names and toggling Google Maps over top helps. Lot of other uses at the link above and well as a collection of other maps.

    But I always appreciate the way you keep looking to stretch the usefulness of Google Earth. Next to maybe MS Office, in my mind, the greatest application ever produced.

    Terry



PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.