Search code examples
leafletturfjs

turf function booleanPointOnLine returns wrong result


If I try to use booleanPointOnLine, it always returns false. Even if point is placed on line.

jsfiddle

You can see two lines where one marker is placed on line and another is not:

enter image description here

booleanPointOnLine returns false for both.

If I try to change epsilon parameter to whatever number, booleanPointOnLine returns true for both.


Solution

  • I think you set the epsilon to a to high value. You need a lower one because it depends on the length of the decimal places:

    { epsilon: 5e-8 }
    

    enter image description here

    https://jsfiddle.net/bxueharL/