How to Create and Overlay KML on a Google Map Using Google’s My Maps

Originally posted Friday, 6 April 2007

Mission Data
Mission Data Journal
4 min readApr 22, 2016

--

A few days ago Google made their “My Maps” announcement and since then there has been nothing but buzz buzz buzz about it. So I figured I would take a minute to show how someone can use this new tool from Google to create their own embedded maps for their site.

The first step is to create your new map. Go to Google Maps and click on the new “My Maps” tab.

Now you create your map. You can create polygons, lines or just points and include whatever you want in the descriptions because it will all be included in the KML.

Once you have completed your map you want to go to click on the KML link at the top right to save the KML for this map to disk.

Just last month Google added support for KML overlays to their map API. It isn’t very well documented on the GGeoXml documentation page but there is only one real issue you have to know about. The main thing to understand is that the KML file must sit on a public webserver somewhere and when you reference it Google needs to be able to access it. For example if you are testing on your local box and you put something like “http://localhost/mykml.kml” in for the URL it will not work. After you get past that the path to using your saved KML file is easy. Here is a full example:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAcktFen-Z7CQCe0dxIKmxeRReUzuwBhfUVuhk2aRjVRv1avb-hhQdlkzQnQ1P5PComj1CZx2jeOOyIw" type="text/javascript"></script>
<script type="text/javascript"></script>

Notice that you have to zoom and center to somewhere since that isn’t controlled by the KML file but other than that it makes creating embedded maps very simple.

And here are the results from the example:

Enjoy!

Teaser graphic with text that states “Transform your business with innovative digital products.”

About Mission Data

We’re designers, engineers, and strategists building innovative digital products that transform the way companies do business. Learn more: https://www.missiondata.com.

9 Responses to “How to Create and Overlay KML on a Google Map Using Google’s My Maps”

  1. April 15th, 2007 @ 7:49 pm Jeff responded:
    Hi! Thanks for posting clear instructions on how to embed a MyMap into a blog. Is there a way to embed the map without having to download the KML file to a local host and instead link to the KML Google keeps on its’ servers? I am hiking the Appalachian Trail and would like to add content to MyMaps on my journey and have it reflected in the embedded MyMap on my blog. I know that Google Maps can open the link to the KML link they provide when you click the KML button. I just copied and pasted it into the ‘search the map’ dialog box and it goes to the MyMap I created. So it seems there must be a way to have the embed html file input the link of the KML google provides.
    Thanks!
    ~Jeff
  2. April 16th, 2007 @ 7:32 am carsonm responded:
    I wondered the same thing myself but I don’t see anything that Google has that explicitly lets you do this. However it looks like the save to KML link will work if you are logged in or not. So it seems that you should be able to link directly to the KML download link however I’m not sure if it will stay that way or not.
  3. April 22nd, 2007 @ 1:54 pm Jeff responded:
    Hi Carson,
    I was finally able to piece together enough information from various sources to embed a My Map on my site without downloading the KML file to a local server which therefore, keeps it actively update-able (as long as they don’t change the KML link). I believe the only main differences are the addition of a new variable, geoXML that references the GGeoXML; and geoXML is referenced by map.addOverlay command. I’m not a programmer by any means but it seems to work.
    http://www.trackjeff.com/bpmymap/
    The code —
    http://www.trackjeff.com/wp-content/uploads/2007/04/whereontheatmm.html
    maps.google.com -
    http://maps.google.com/maps/ms?f=l&near=&layer=&ie=UTF8&om=1&hl=en&z=4&t=h&msid=109703179057701469817.00000111f64f480190d5f&msa=0
    Check it out! I also wrote my friend instructions that I would be happy to send you.
    ~Jeff
  4. May 1st, 2007 @ 2:44 pm Thomas Paine responded:
    @Jeff Yes you can! I just wrote a long and detailed message about how you can accomplish that and stupid wordpress didn’t like the security code and forced me to use the much hated back button which caused me to loose everything. So now I’m just going to give you some links cause I don’t want to write it all over again.
    http://groups.google.com/group/Google-Maps-API/browse_thread/thread/02f0e7bf417c4075/#
    http://www.google.com/apis/maps/documentation/kmlOverlay.html
    My implementations (pages are likely to change soon though)
    http://thomasandcarrie.com/registry.php
    http://thomasandcarrie.com/registry_test.php
  5. May 17th, 2007 @ 1:22 pm TourPro responded:
    I discovered that the KML can have a network link to a Google My Maps KML. Update that map and any published map also get updated.
    Thanks for this very helpful tip!
  6. May 19th, 2007 @ 5:55 am Rob responded:
    http://www.mymapsplus.com has a tool to embed My Maps. Theres an option to update the script daily in case the KML changes, and theres a configurable sidebar too
  7. May 21st, 2007 @ 2:34 am Jørn responded:
    The text bubbles seem to have gone blank.
  8. January 19th, 2011 @ 5:31 pm Davids responded:
    Nice post!
    Thanks
  9. May 11th, 2011 @ 10:15 am Vaishakh responded:
    Thanks for the info but one thing I would like to point out is that the kml file you get using this method cannot be directly integrated into the Google Maps code .For that checkout this link
    http://bestfromgoogle.blogspot.com/2011/05/google-my-maps-kml-integration-for-your_4609.html

--

--

Mission Data
Mission Data Journal

We build smart digital products that transform the way companies do business.