Polylines with start and end of location in Google maps v3 -
i have drawing polylines following:
var data = json.parse(data); var linecordinates = new array(); (i=0; i<data.length; i++){ linecordinates[i] = new google.maps.latlng(data[i].fields.latitude, data[i].fields.longitude); } linepath = new google.maps.polyline({ path: linecordinates, geodesic: true, strokecolor: '#ff0000', strokeopacity: 1.0, strokeweight: 2 }); linepath.setmap(map); }
i want place marker
@ start of polygon line
, end
of polygon line. how that?
- documentation on google.maps.polyline
-
var startmarker = new google.maps.marker({ position:linepath.getpath().getat(0), map:map }); var endmarker = new google.maps.marker({ position:linepath.getpath().getat(linepath.getpath().getlength()-1), map:map });
Comments
Post a Comment