Google Blogoscoped

Monday, September 25, 2006

Finding and Creating Google Maps Overlays

Google Maps allows you to overlay a map with custom data. To do so, you enter the full URL of a “KML” or “KMZ” file into the Google Maps search box. A KML file is an XML file containing such things as place marks with titles and descriptions – like the label “this is my house” put on top of your home coordinates – and a KMZ file is simply a zipped KML file. (Google Earth was called Keyhole before Google acquired it, so KML means Keyhole Markup Language.)

Here’s a KML URL containing two locations for sample purposes:
http://blog.outer-court.com/files/kmz-sample.kml

And this is the URL to overlay this file on Google Maps:
http://maps.google.com/maps?q=http://blog.outer- court.com/files/kmz-sample.kml

(Note that I replaced the default icon with my own by changing the <Icon><href>...</href></Icon> part in the KML file. I’m also adding my own images in the info box by use of a CData/ XHTML snippet within the description element.)

Finding KML files

How do you go on about finding more such KML files? One approach is to query Google for the following:

(inurl:kmz | inurl:kml) “kml xmlns”

This search basically means: find any file with “KMZ” or “KML” in the URL that contains the string “kml xmlns”. KML and KMZ is the file extension we’re hoping to find, and the string <kml xmlns="http://earth.google.com/kml/2.1"> appears in the XML, so this is a good way to drill down to just KML files.

At the moment, the seach returns around 190,000 results, and most of the ones shown are indeed KML files. You can also combine above search with a keyphrase of your choice, e.g. New York:

(inurl:kmz | inurl:kml) “kml xmlns” “new york”

Here are some Google Maps files found this way:

Creating KML files

To visually create a KML/ KMZ file, all you need is to download the free Google Earth, the big desktop brother of Google Maps with smoother animations. (The latest version is release 4 Beta, which was last updated around two weeks ago.)

When you run Google Earth, you will see a “places" frame to the left. Whenever you zoom into a place and click the place marker on top, a new location is added to your places (you can also create specific folders to put locations into, e.g. “my public places” and “my private places” or “my favorite holiday spots”). You then add a title and description to your place.

To export your place to a KMZ file, right-click a location in your places frame – like a folder – and choose “Save as...”. You can now upload the saved file to any webspace to put it on top of Google Maps by appending your KML URL to “http://maps.google.com/maps?q=".

Advertisement

 
Blog  |  Forum     more >> Archive | Feed | Google's blogs | About
Advertisement

 

This site unofficially covers Google™ and more with some rights reserved. Join our forum!