USGS-WiM / StreamStats

USGS StreamStats
https://streamstats.usgs.gov/ss/
Other
15 stars 7 forks source link

Fixes #1941 Self-intersections - Basins not merging #1965

Closed amedenblik closed 6 months ago

amedenblik commented 6 months ago

Closes #1941

Was able to fix this issue by looking at each globalwatershed's geometry.coordinates. In the case of self-intersection, geometry.coordinates would be an array of arrays. One of the arrays would be very small (the self-intersection piece). I figured out which array was the longest of them all and used that for the geometry.coordinates.

Sometimes the merged polygons would also have self-intersections, so I repeated this process on the final, merged polygon as well.

I experimented with upgrading turfjs to the latest version, but it didn't help.

Will need to manually close #1941 after merge.