Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.96k stars 992 forks source link

Do you have an example of using the intersects () method #983

Open wp0spark opened 4 years ago

wp0spark commented 4 years ago

Do you have an example of using the intersects () method image

spatterson82 commented 3 years ago

I was looking around for issues with using L.Polygon.intersects() with a polygon that has an interior polygon/donut.
I have been using the intersects() method to see if any polygon that is drawn or loaded and added to the draw toolbar does not intersect itself. I attached a code snippet as an example. ` // drawnLayers is the featureGroup for editing that is set up when creating the L.Control.Draw object const layers = drawnLayers .getLayers() for (const layer of layers) { if (layer.intersects()) { alert('One of your polygons intersects itself'); } }

`