Closed noisyneuron closed 1 month ago
I don't think this is an issue with geodesics as the LineString still intersects in a globe view:
The issue can be simplified to this CodeSandbox: https://codesandbox.io/s/turf-issue-2424-p1w4pe?file=/src/index.js
Dug into this a bit further. Looking at the test data using one reference system (EPSG:3395) "WGS 84 / World Mercator" shows intersections for both:
Using another reference system (EPSG:4326) "WGS 84" shows only an intersection with the large rectangle:
I'm going to guess the math sweepline-intersections uses is matched more closely by the latter projection.
It raises the question of how should Turf interpret a line between two points: as a constant bearing rhumb line projected on a flat surface, or as a great circle segment on a sphere? Given it's your use case @noisyneuron, what were you expecting with the data you had?
FYI this is what the great circle path looks like:
Closing in lieu of further background from OP. Please reopen if more details come to light.
In using
booleanIntersects
for a line and polygon, it appears that the geodesic/rhumb(?) line is used for calculation rather than the visual lineIn the screenshot, the smaller polygon (poly1) returns
false
where as the larger one (poly2) returnstrue
. Code sandbox: https://codesandbox.io/s/turftests-zbnhot?file=/src/index.jsTurf v6.5.0