Hi,
I am trying to draw a route with some points but I don't know how I
can do it because when I use a getpolyline method from object
GDirections these always return a undefine value.
I do this:
// I have two arrays, one with the latitude points and the other with
the longitudes
for (i = 0, total = old_points_lat.length; i < total; i ++)
{
// we create the point
var point = new GLatLng(old_points_lat[i],old_points_lng
[i]); // works fine
if (waypoints.length == 0) {
GDir1.loadFromWaypoints([point.toUrlValue(6),
point.toUrlValue(6)], {getPolyline:true});
}
else {
GDir1.loadFromWaypoints([waypoints
[waypoints.length-1].getPoint(), point.toUrlValue(6)],
{getPolyline:true});
}
// we create the marker and draw it in the map
var marker = new GMarker(point, {icon:iconNode,
draggable:true, dragCrossMove:false, bouncy:false,
zIndexProcess:function(marker,b) {return 1;}});
marker.MyIndex = waypoints.length;
waypoints.push(marker);
map.addOverlay(marker);
// if we have more of two points in the map, we want draw the
polyline
if (waypoints.length > 1) {
var gp=GDir1.getPolyline();//ERROR, gp is always
undefined
map.addOverlay(gp);
gpolys.push(gp);
}
}
Can any help me? How can I do this?
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.