Upgrade sweepline-intersections - #3070
Conversation
…rtex Upgrading sweepline-intersections in line-intersect started to cause failures in boolean-crosses. It looks like rowanwins/sweepline-intersections@e7a48be added endpoint intersection detection. When trying to grapple with this back in boolean-crosses, I noticed that the booleanEqual first parameter was a geometry but the second was a feature which was causing it to return false even when the [1, 1] point was used in the coordinate arrays of both. After fixing the doLineStringsCross method, it fixed the test that had been marked as false, but now the true test is failing. From spot-checking against PostGIS I think we're actually supposed to return false if two linestrings only cross at an end point. postgres=# SELECT ST_Crosses( postgres(# 'LINESTRING(-2 1, 4 1)'::geometry, postgres(# 'LINESTRING(1 1, 1 2, 1 3, 1 4)'::geometry postgres(# ); st_crosses ------------ f (1 row) postgres=# SELECT ST_Crosses( 'LINESTRING(-2 2, 1 1)'::geometry, 'LINESTRING(1 1, 1 2, 1 3, 1 4)'::geometry ); st_crosses ------------ f (1 row)
|
@rexxars Any chance you have a minute to verify that the change to line/line intersect behavior (under Breaking in the PR description) is the right thing to do? |
|
I've convinced myself that this can belong in 7.x because we're fixing a correctness bug to match DE-9IM and the docs as written. It also updates the sweepline-intersections code to pick up the latest changes, but sadly we had to inline it because the maintainer has been unresponsive to a PR that fixes some of its dependencies. If we took the newer versions as-is, we would be declaring an old version of esbuild as a transitive (non-dev) dependency. |
|
I backed out tinyqueue@3 and robust-predicates@3 (both to 2.x) to fix issues with node@18 compat in turf@7. I intend to bump everything to the newer versions once we start working towards turf@8 and drop support for node@18. |
Upgrades
sweepline-intersectionsto pick up fixes forarethetypeswrong. There is also a change rowanwins/sweepline-intersections@e7a48be where it adds detection for endpoint intersections which previously did not exist.Breaking:
This changes the behavior of @turf/boolean-crosses from returning true to false when the line/line intersection is on an end point. I think this matches the DE9IM intended behavior now.
Todo:
Clean up the transitive dependencies Fix package.json dependencies/devDependencies rowanwins/sweepline-intersections#25(I wound up just vendoring the code directly since the PR hasn't gotten a response yet)Investigate why we had to back this change out last time and address that(I thought there was an issue with these packages, but I incorrectly remembered what packages Reverted backward incompatible fix to nearestPointOnLine #3017 involved. Still it may be reasonable to wait for v8 if we're going to change the results for crosses on endpoints.)Note: tinyqueue@3 (released nearly 2 years ago) breaks node@18 compatibility. So that's another point towards only including this in turf@8.