Skip to content

booleanPointOnLine fails for aligned points #2826

@cdeclerck

Description

@cdeclerck

📝 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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions