Turfjs / Turfjs/turf

booleanPointOnLine fails for aligned points

Open
#2,826 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/boolean-point-on-line
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

📝 Description

The function turf.booleanPointOnLine incorrectly returns false when checking if a point lies on a line, even when the point is perfectly aligned with the line segment. This behavior occurs under the following conditions:

📍 Coordinates
  • Point to check: [1.1491048489081164, 47.97013091862306]
  • Line segment:
    • Point 1: [1.1497411448453079, 47.97009507298361]
    • Point 2: [1.1489123422593934, 47.970141763457235]
🔍 Steps to Reproduce
import * as turf from '@turf/turf';

// Define the line segment
const line = turf.lineString([
    [1.1497411448453079, 47.97009507298361],
    [1.1489123422593934, 47.970141763457235],
]);

// Define the point
const point = turf.point([1.1491048489081164, 47.97013091862306]);

// Check if the point is on the line
const result = turf.booleanPointOnLine(point, line);

console.log("Is the point on the line?", result); // Expected: true, but returns false

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the turf.booleanPointOnLine entry point and reproduce the reported result with the provided coordinates. Trace the point-to-segment alignment and precision handling, then verify that this case returns true without breaking other line-membership behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.