Need help opening a Google Docs kml file in Google Maps Api

35 views
Skip to first unread message

J Green

unread,
Oct 5, 2011, 4:49:38 PM10/5/11
to kml-support-g...@googlegroups.com
I am not a strong developer and need some help to make a Google Map.
I want to make a Google Map Javascript Api that will overlay a Google Docs Public kml file.
So far I have the code below that shows that Google Maps Api but the Google Docs public kml file does not display.

Note:  I removed my key from the post below.
The Public KML files can be found here:  https://docs.google.com/leaf?id=0BwJEYHaOTM6POWM5OWUxMzYtYWMzZC00NTg1LWExYzMtMjQ1YzFiMGIyNmVl&hl=en_GB

Can you help me?



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://www.google.com/jsapi?key=XXXXXXXXXXXXXXXXXXXXXX"></script>

<script type="text/javascript">
    google.load("maps","2", {"other_params":"sensor=false"});
    function init() {
      map = new google.maps.Map2(document.getElementById("map"));
      var myLatLng = new google.maps.LatLng(52.126096, -106.659066);
      var myMarker = new google.maps.Marker(myLatLng, {"draggable":"true","title":"City of Bridges"});
var mapstraction;
      map.setCenter(myLatLng,10);
      map.addControl(new google.maps.SmallMapControl());
      map.addControl(new google.maps.MapTypeControl());
      map.setMapType(G_ROAD_MAP);
      map.addOverlay(myMarker);
mapstraction.addOverlay("https://docs.google.com/leaf?id=0BwJEYHaOTM6POWM5OWUxMzYtYWMzZC00NTg1LWExYzMtMjQ1YzFiMGIyNmVl&hl=en_GB", true);
    };
    google.setOnLoadCallback(init);
  </script>
<title>My first Google Map</title>
</head>
<body onunload="google.maps.Unload()">
<div id="map" style="width: 500px; height: 300px; margin: auto; background-color: red">
This is where the map will soon appear.
</div>
</body>
</html>

Rossko

unread,
Oct 6, 2011, 5:06:13 AM10/6/11
to KML Developer Support - Getting Started with KML
> var mapstraction;
...
> mapstraction.addOverlay("https://docs.google.com/leaf?...

What is 'mapstraction', why would you expect it to have an addOverlay
method?

Look into using GGeoXml
http://code.google.com/apis/maps/documentation/javascript/v2/services.html#XML_Overlays
Reply all
Reply to author
Forward
0 new messages