Dear,
I have some trouble to extract from XML file to a tab some Lat Lng
points.
On the code bellow, I create a tab "pointsparcours" that will contain
all the coordinate of the XML file.
I use pointsparcours.push(pts[i]); that work fine at this point
(alert(pointsparcours[0]); show me that the coordinate are well
pushed).
The problem is that I can't get this tab data out.
The last line alert(pointsparcours[0]); give me an "undefined" alert
message.
How could I get this tab with data for an external use ? (...if
possible).
Thanks !!
//***********************
var side_bar_html = "";
var gmarkers = [];
var htmls = [];
var i = 0;
var request = GXmlHttp.create();
request.open("GET", "example-valmy-15.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = GXml.parse(request.responseText);
// ========= Now process the polylines ===========
var lines =
xmlDoc.documentElement.getElementsByTagName("line");
// read each line
for (var a = 0; a < lines.length; a++) {
// get any line attributes
var colour = lines[a].getAttribute("colour");
var width = parseFloat(lines[a].getAttribute("width"));
// read each point on that line
var pointsparcoursxml =
lines[a].getElementsByTagName("point");
var pointsparcours = [];
var pts = [];
for (var i = 0; i < pointsparcoursxml.length; i++) {
pts[i] = new
GLatLng(parseFloat(pointsparcoursxml[i].getAttribute("lat")),
parseFloat(pointsparcoursxml[i].getAttribute("lng")));
pointsparcours.push(pts[i]);
alert(pointsparcours[0]);
}
polyx = new GPolyline(pts,colour,width);
map.addOverlay(polyx);
}
//
================================================
}
}
request.send(null);
alert(pointsparcours[0]);
//***********************
--
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.