Check if a route crosses something

Hi everybody,i’m new here.

I’ve been looking for days for a way to check if a route crosses one or more polygons

I use leaflet js, i tried to solve it with Turf.js but routes and polygons contains a lot of segments and it was very long

Maybe I’m looking wrong

Thanks in advance for your help and ideas.

Hey,

it looks like turfs booleanIntersects might do the trick, and that should be able to handle GeoJSON Features, which (at least for the route) are being returned by the /geojson-endpoint.

Best regards

Hi,

I was using a bad endpoint when I tested these functions,
I just tried with /geojson-endpoint, and it works as I want.

Thanks a lot!

1 Like