Unfortunately I am unable to put a link up. But here is the code in
question:
if (line != null) {
map.removeOverlay(line);
}
var oldstr = document.getElementById("panel").value;
var waypoints = oldstr.split("\n");
var x;
var points = new Array();
for (x in waypoints) {
var lat = waypoints[x].substr(0,waypoints[x].indexOf
(","));
var lng = waypoints[x].substr(waypoints[x].indexOf(",") +
1,waypoints[x].length);
if ((lat != "") && (lng != "")) {
point = new GLatLng(lat,lng);
points.push(point);
}
if (x == waypoints.length - 1)
{
map.setCenter(point);
marker.setLatLng(point);
}
}
line = new GPolyline(points, "#ff0000", 10);
map.addOverlay(line);
There shouldn't be any extra commas at the end of the array. I'm
storing my waypoints in a hidden field called "panel".
Please let me know if this is enough, otherwise I'll start working on
isolating the module and putting it up on a seperate page.
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
-~----------~----~----~----~------~----~------~--~---