I am building a test page on an internal web server and can't get the
polylines to get drawn from an XML file.  I am very much a newbie to
javascript.
I was able to get the examples from the Google Maps API Docs pages to
work (drawing polylines and parsing data (points) to a map) so I know
my browser (Firefox) works with it.

The map comes to screen correctly but the lines don't get drawn.
No errors are being reported.

The code can be found below:

<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=<removed>&sensor=true_or_false"
type="text/javascript"></script>
<script type="text/javascript">

  function createMap() {
  var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(43.154791, -77.610953), 15);
        map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());

GDownloadUrl("data.xml", function(data) {
  var xml = GXml.parse(data);
  var links = xml.documentElement.getElementsByTagName("link");
  for (var i = 0; i < links.length; i++) {

  var polyline = new GPolyline([
                 new GLatLng(parseFloat(links[i].getAttribute
("lat1"))), (parseFloat(links[i].getAttribute("lng1"))),
                 new GLatLng(parseFloat(links[i].getAttribute
("lat2"))), (parseFloat(links[i].getAttribute("lng2")))
                                 ], "#ff0000", 10);

  map.addOverlay(polyline);
  }
  }
  );
  }
  </script>
</head>
<body onload="createMap()" onunload="GUnload()">
<div id="map_canvas" style="width: 1000px; height: 600px"></div>
</body>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to