Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript
https://turfjs.org/
MIT License
9.35k stars 941 forks source link

turf.intersect to fit isobands results in incorrect output #1908

Open BMERI opened 4 years ago

BMERI commented 4 years ago

Good morning all,

I am using turf and Mapbox to draw isobands in a circular area by: Using turf.interpolate to generate the grid of values, Using turf.isobands to draw isobands on the resulted rectangular grid, Then using turf.intersect to cut the bands to fit into the circular area {the intersect between the area and each band or between the area and each polygon in the band in case the band.geometry.coordinates.length > 1, taking into account that if the intersection is null this means the band/polygon is fully contained within the area}

The issue is that: this works well but infrequently the result contains outside the area a part from the original isobands which expected to be cut using the intersection to fit the bands totally in the area. This is an illustrative image. Any help to generate the correct required result would be appreciated Thank you.

image

smallsaucepan commented 2 months ago

Hi @BMERI. Obviously it's been a while since you raised this. Do you have some test files still available? That will help us reproduce and fix the issue.