I am looking for an online solution for leaflet where I can select and export (console log, geojson, addLayer) a group of polygon from a geojson file which intersect with a drawn polygon (with leaflet draw). Please see the picture:

enter image description here

I tested Esri leaflet but for some reason it is not working form me. I am not sure if it requires an online esri license or I did something wrong (my layer was a geojson not an esri source layer), however I did not get any error messages and also nothing happened. Could anybody confirm this plugin works free without the necessity of any esri related license or data?. If not, my second question is can this question be solved with turf javascript? I know there is turf intersect: var intersection = turf.intersect(poly1, poly2); but this is between 2 polygons and also the end result is new geometry and not a selection of existing ones.

I also find this link which looks useful, but doesn't work for me and I guess the end result would be a new geometries of the intersection: Intersecting FeatureCollections in turf.js?

  • *I use leaflet 0.7.7
    – Tamas Kosa
    Jul 12, 2017 at 16:06

1 Answer 1


if you're not generating from your app, you can create a free developer account and publish a new service from your .geojson and use Esri Leaflet to easily perform a spatial query. you can find more info about the terms of use here

you can also just continue to use turf and loop through each and every feature you want to test and call intersect(). if it returns undefined, the polygons don't intersect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.