I need help,

when I use GDownloadUrl to download .xml file with coordinates to draw
polyline on my map I get "map is undefined" error. Here is code:

GDownloadUrl("locLog.xml", function(data) {
                  xml = GXml.parse(data);
                  links = xml.documentElement.getElementsByTagName("link");
                  for (i; i < links.length; i++) {
                  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);

                  this.map.addOverlay(polyline);
                  }
                  }
                  );

And when I use this code:

for (i; i < 3; i++) {
polyline = new GPolyline([
new GLatLng(parseFloat(43.154791), parseFloat(-77.610953)),
 new GLatLng(parseFloat(43.154827), parseFloat(-77.605858))
 ], "#ff0000", 10);

this.map.addOverlay(polyline);
 }

it WORKS! (all variables are global)

Anyone? Thanks!

--~--~---------~--~----~------------~-------~--~----~
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