Advertisement
Advertisement
| 05.23.2008 at 04:25AM PDT, ID: 23427203 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: |
// ========= Now process the polylines ===========
var lines = xmlDoc.documentElement.getElementsByTagName( "poi_route" );
// 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 = [];
var sTo = "";
for ( var i = 0; i < points.length; i++ ) {
pts[ i ] = new GLatLng( parseFloat( points[ i ].getAttribute( "lat" ) ),
parseFloat( points[ i ].getAttribute( "lng" ) ) );
if(i==0) sTo+="from: ";
else sTo+="to: ";
sTo+=points[i].getAttribute("lat");
sTo+=",";
sTo+=points[i].getAttribute("lng");
sTo+=" ";
}
// map.addOverlay(new GPolyline(pts,colour,width));
// This draws the straight-line but if i comment it out No route appears for India because GDirections isn't supported there!
map.addOverlay( new GPolyline( pts ) );
var gdir = new GDirections(map);
gdir.load(sTo);
}
// ================================================
|