Reputation: 423
I am using leaflet map, which can contain polygon(s). I want to check that map has any polygon and if it has then i want to find coordinates of that polygon?
Upvotes: 0
Views: 2359
Reputation: 11338
map.eachLayer(function(layer){
if(layer instanceof L.Polygon && !(layer instanceof L.Rectangle) ){
console.log(layer.getLatLngs());
}
});
Upvotes: 3