-
Notifications
You must be signed in to change notification settings - Fork 944
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
pointOnLine.location does not return correct distance #722
Comments
@Andi-Lo Thanks for reporting this issue. I've managed to get the result closer to the station point by applying We should try to replicate this behavior in the TurfJS tests. Example -
|
Related To-Do on |
Thanks for reply, until it is fixed I will use a workaround (measuring all sub-segments with turfs lineDistance module) |
@Andi-Lo Feel free to send a PR if you do find a solution for the |
@dpmcmlxxvi not sure how to validate. I would need to checkout the turf master branch and get myself a bundled turf.min.js file and include that in my project to see if results are not as expected or is there a faster way? |
@Andi-Lo That's what I do. Check out, install, and build. Then you can use |
There isn't any nightly builds, however it might be a good idea. The process would need to be automated and be based on the master branch. |
With the latest release I updated the version of my fiddle: https://jsfiddle.net/andi_lo/95q4Lgqc/ As you can see the result seems now correct to me. Nice work @dpmcmlxxvi ! |
👍 Glad it works, definitely nice work from @dpmcmlxxvi |
I currently wonder if the @turf/pointOnLine package does return a wrong location value.
Here is a short fiddle of the problem:
http://jsfiddle.net/andi_lo/95q4Lgqc/
I would like to set a point (which is a train station in my project) onto the polyline (representing the routes shape) via
turf.pointOnLine
and use the returning location property as of how far the train traveled. However if I use turf.along with the distance provided byturf.pointOnLine(...).properties.location
I will get a point that does not match my expectations. I would expect to get a point that lays onto the station but I get a point that is positioned falsely.The used geojson is inside the fiddle. Feel free to ask for clarification if needed.
The text was updated successfully, but these errors were encountered: