-
Notifications
You must be signed in to change notification settings - Fork 938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
splitLineWithPoints doesn't split correctly #2604
Comments
Thanks for the detailed write up @kudlav. For the second example (which returns an incorrect result) I noticed the co-ordinates are outside what would typically be expected as valid geojson for Turf:
[lng, lat] respectively would typically be -180 to +180, and -90 to +90 decimal degrees. Can you run through your use case in more depth if those are the values you need to use? What is the significance of the scaling? |
Hi, you are right. I'm working out of WGS84 range. Other turf functions are fine with it. I'll normalize our range into WGS84 before using the splitLineWithPoints as a workaround. |
turf.lineSplit
is not splitting properly large geometries, even after removing the square as suggested in #1232.I have two cases. The first is on a scale of 1:100, and the second is 1:1 (original). For the first one, it returns 5 segments (correct), for the second one only 4 of 5 segments.
The problem is in
splitLineWithPoints
function.It gets correctly the same 4 intersections, the splitter parameter is:
This code doesn't check if the
closestLine
was actually split into two lines. And, in my second case, whensplitLineWithPoint
splitting using point[771.0658597785978, 2882.976740278172]
, thesplitLineWithPoint
returns only one line instead of twos (the splitting or choosing theclosestLine
is broken).turf/packages/turf-line-split/index.js
Lines 105 to 109 in c76e6e9
@turf/turf v7.0.0-alpha.115
Node.js v20.11.1
The text was updated successfully, but these errors were encountered: