I am trying to select all neighboring polygons in mapbox gl using turf.js and I am using
turf.intersect(poly[0], item);
And sometimes it is fine, but it looks like the input polygons data is bad, and it looks like there is some gaps between neigbour polygons coordinates(the neighbour points lat/lon doesn not match, or multipolygons), so is there any other algorithm to get the neighbour polygons? 
This is working as it should. The reason it is not selecting the polygon above is because it is not a neighbor (due to bad geometry etc.).
A way to work around this bad geometry would be to buffer the polygon by a small amount and then do an intersect using the slightly larger buffered layer that will span the gaps between your existing polygons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With