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.
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.