ok thanks you very much 2009/2/17 warden [Andrew Leach - Maps API Guru] < [email protected]>
> > 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 > > > -- Alvarez-Pinnelli Laurent Master ISI Informatique UFR Sciences et Techniques - Université de Corse Lauréat du concours de technicien supérieur territorial --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
