geolocation - creating and adjusting color of L.polygon in leafletjs -
i working leaflet library v. 0.7.7 want create polygon, set markers , define polygon colors, there no way
var polygon = new l.polygon(); <c:foreach var="marker" items="${markers}" varstatus="rowindex"> var marker${rowindex.index} = l.marker([${marker.lat},${marker.lng}],{icon: yellowicon,title: '${marker.title}'}).addto(mymap) .bindpopup( "${marker.htmlmarkerpopupcode}").openpopup(); polygon.addlayer (marker${rowindex.index}); </c:foreach> polygon.setstyle({fillcolor: '#0000ff'}); polygon.setstyle({color: 'red'}); polygon.setstyle({fillopacity: 0.5}); mymap.addlayer( polygon );
unfortunately l.polygon
single layer, not layer group. not supposed contain other layers / markers.
the polygon.addlayer()
line should throw error.
if understanding correct, draw polygon vertices markers? in case, should read markers coordinates , store them array, build polygon using array of coordinates.
then styling / colors should work.
Comments
Post a Comment