How can I find the inner bounds of a polygon in Leaflet? I a want to plot points randomly in polygon but when I say
Layer.getBounds()
I get the bounds and I can still plot the markers approximately with in the saure i draw except most of them fall far out the intended polygons. This is because, getBounds()
gives me out bounds.
Does any one have an idea how I can get inner bounds of a polygon?
Best Answer
Mapbox has a pointinpolygon you could use. https://github.com/mapbox/leaflet-pip Layer must be: L.geoJSON layer
Then use something like :