-
Notifications
You must be signed in to change notification settings - Fork 942
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
nearestPointOnLine deviation #1440
Comments
Good question @MichelBahl Will have to take a scratch through the code base to work out what's going on. Probably a low priority though for me at the moment sorry, so might take a little while before I get to it. |
@MichelBahl Can you show what the actual deviation is with the ones in the example that you're saying are off the line? The snapped points look like they're on the line when zooming in. https://github.com/Turfjs/turf/blob/master/packages/turf-nearest-point-on-line/index.ts#L71:L77 It's calling |
This issue is THE big blocker preventing me to use turf for anything serious, it should be a very high priority. I have examples ( in #2023 ) where nearestPointOnLine is off by 50km on lines that are 500km! That's 10% In turn it impacts other functions and "contaminates" a large part of turf:
|
Hi @crubier As you mentioned over in #2023 (comment) yes this is most likely an inconsistency as to whether things are using a rhumb vs haversine calculations, and so the longer a line you use then the worse the effects are. That said, TurfJS is maintained by the good will of a few individuals in their spare time, we do our best to fix various issues but catering to everyone else's priorities is always going to be close to impossible. Pull requests are always welcome. One day Turf will hopefully be robust and consistent, but it will take a while (JTS is still under development after starting in the year 2000). Thanks, |
Hi @rowanwins no problem, I noticed that and I myself have not much time to maintain my own open source contributions, so I know the pain. I'd happily contribute to turf if I had time or no alternative, but for now I fallback to using qgis and python more my precision-critical stuff. I would have loved to use Turf for that, but as I said this is not possible for now. I'm not complaining or asking anyone to take action, just explaining the limitations, so that other users don't waste a few days like I did trying to implement complex precision-critical algorithms on top of turf, only to realize that this is not currently possible. Turf is awesome and I love it, it's perfect for a lot of use cases but it's good to warn people that it is not an implementation correct enough for uses cases that need precision. The idea of having a nice and clean JS reference GIS library is awesome, I hope we'll get there one day. I don't have time but my company sponsors open source projects and I'd be happy to sponsor turf to help reach this goal. I'm not able to spend massive amounts though, so we'd need some sort of sponsor community to really get this off the ground |
Hi @MichelBahl. Not sure if you recall this issue. Was your expectation that nearestPointOnLine would take you to the nearest vertex of a line segment? Rather than the nearest point along that line? Revisiting some of these issues and realise I'm not 100% on what your original report was pointing out. Thanks |
Here is an small example.
Some points at the line were calculated right on point and
some were calculated with a deviation.
I wanna know what's the reason for the deviation,
for me it seems to be to big for an round-off error.
The text was updated successfully, but these errors were encountered: