question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pointOnLine.location does not return correct distance

See original GitHub issue

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 by turf.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.

turf_pointonline

The used geojson is inside the fiddle. Feel free to ask for clarification if needed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
DenisCarrierecommented, May 8, 2017

Related To-Do on @turf/along: https://github.com/Turfjs/turf/issues/691

0reactions
DenisCarrierecommented, Jun 7, 2017

👍 Glad it works, definitely nice work from @dpmcmlxxvi

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check is a point (x,y) is between two points drawn on a ...
if (distance(A, C) + distance(B, C) == distance(A, B)) return true; // C is on the line. return false; // C is not...
Read more >
how to use st_distance for closest location? - Microsoft Q&A
My query returns a list of the locations within the given radius from the given point. How would I return the closest location...
Read more >
CadQuery Class Summary
Returns true if this shape is null. In other words, it references no underlying shape with the potential to be given a location...
Read more >
Inform and engage your community - PulsePoint
PulsePoint helps create an informed and engaged community that drives a “Culture of Action,” a key strategy in strengthening the Chain of Survival...
Read more >
Reference Manual - Rose Point Navigation Systems
The Instrument Panels are normally closed when not underway and open when underway. When they are closed, only the names of the panels...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found