I am sorry this is the code snippet
function showvehiclepath(dateS,dateE,uid){
clearInterval(setintervalID);
//alert(dateS +" "+dateE+" "+uid);
var requestpath = GXmlHttp.create();
map.clearOverlays();
requestpath.open("GET", "../server/vehicle_path.php?
x="+dateS+"&y="+dateE+"&z="+uid, true);
requestpath.onreadystatechange = function() {
if (requestpath.readyState == 4) {
// var xmlDocpath = GXml.parse(requestpath.responseText);
var xmlDocpath = requestpath.responseXML;
// ========= Now process the polylines ===========
var lines = xmlDocpath.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 points = lines[a].getElementsByTagName("point");
var pts = [];
if(points.length==1){
alert("no recourds found");
map.setCenter(new GLatLng(45.246421814,19.7935199738),
4);
}
else
{
for (var i = 0; i < points.length; i++) {
var l=points.length-1;
var mpnt=l/2;
var pnt=Math.round(mpnt);
pts[i] = new GLatLng(parseFloat(points[i].getAttribute
("lat")),
parseFloat(points[i].getAttribute
("lng")));
map.setCenter(new GLatLng(parseFloat(points
[pnt].getAttribute("lat")),
parseFloat(points[pnt].getAttribute
("lng"))),7);
var start_icon=new GLatLng(parseFloat(points
[0].getAttribute("lat")),
parseFloat(points[0].getAttribute("lng")));
var end_icon=new GLatLng(parseFloat(points
[l].getAttribute("lat")),
parseFloat(points[l].getAttribute("lng")));
}
map.addOverlay(new GMarker(start_icon,G_START_ICON));
map.addOverlay(new GPolyline(pts,colour,width,0.7));
map.addOverlay(new GMarker(end_icon,G_END_ICON));
}
}
}
}
requestpath.send(null);
}
I am running it in local server so its not possible to give the url.
regards
Rahul R
On Jun 19, 3:46 pm, Rossko <[email protected]> wrote:
> > The below code is used to plot the ployline from a set of points.
>
> Nothing in that snippet ever plots any polyline.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---