Display your KML on a Google Map

Posted on July 12, 2007

KML – the Google Earth/Maps markup language – is a handy and convenient way of displaying geographical information on a google map.

To use it though you need to store your KML on a website somewhere where Google can get at it – which makes for quick and dirty KML experimentations a bit of a pain.

SO, I’ve created a quick little Rails application that let’s you see your KML straight away – without having to go through the rigmarole of saving it in a file somewhere first.

Check it out here: http://www.thechrisoshow.com/display_kml.

To use it, just type some KML into the box, click the button, then move around on the google map – pretty straight forward!

To get you going, here’s some interesting KML as provided by the Google Maps team. Paste this in then zoom up on Sicily!

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<GroundOverlay>
  <description>
     Overlay shows Mount Etna erupting on July 13th, 2001.
  </description>
  <name>Large-scale overlay on terrain</name>
  <LookAt>
    <longitude>15.02468937557116</longitude>
    <latitude>37.67395167941667</latitude>
    <range>30350.36838438907</range>
    <tilt>58.31228652890705</tilt>
    <heading>-16.5581842842829</heading>
  </LookAt>
  <visibility>0</visibility>
  <Icon>
    <href>http://bbs.keyhole.com/ubb/z0302a1700/etna.jpg</href>
  </Icon>
  <LatLonBox id="khLatLonBox751">
    <north>37.91904192681665</north>
    <south>37.46543388598137</south>
    <east>15.35832653742206</east>
    <west>14.60128369746704</west>
    <rotation>0</rotation>
  </LatLonBox>
</GroundOverlay>
</kml>

There’s some more cool KML samples here http://googlemapsapi.blogspot.com/2006/11/kml-on-google-maps.html