On Feb 17, 9:57 am, larenzu <[email protected]> wrote:
> Hello i have a Big Problem :
>          for (var i = 0; i < markers.length; i++) {
>                   var polyline = new GPolyline([
>    new GLatLng(parseFloat(markers[i].getAttribute("lat"))),
>    new GLatLng(parseFloat(markers[i].getAttribute("lng")))
> ], "#ff0000", 10);
> map.addOverlay(polyline);
> }

What is this actually doing? You are creating an array of [lat,lng]
and attempting to use that as a polyline; and you do that six times.

What you need to do is to push each marker's location on to an array
so that you end up with [latlng1, latlng2, latlng3...] and you can
then use that to create the polyline. The following code is untested.

var pointsArray=[];
for (var i=0; i<markers.length;i++) {
  pointsArray.push(
    new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                        parseFloat(markers[i].getAttribute("lng")));
  }
var polyline=new GPolyline(pointsArray, "#ff0000", 10);
map.addOverlay(polyline);

Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to