booleanPointOnLine
Description
Returns true if a point is on a line. Accepts a optional parameter to ignore the start and end vertices of the linestring.
Parameters
Name | Type | Description |
---|---|---|
pt | Coord | GeoJSON Point |
line | Feature<LineString> | GeoJSON LineString |
options? | Object | Optional parameters (default {}) |
options.ignoreEndVertices? | boolean | whether to ignore the start and end vertices. (default false) |
options.epsilon? | number | Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points |
Returns
boolean true/false
Examples
var pt = turf.point([0, 0]);
var line = turf.lineString([
[-1, -1],
[1, 1],
[1.5, 2.2],
]);
var isPointOnLine = turf.booleanPointOnLine(pt, line);
//=true
Installation
$ npm install @turf/boolean-point-on-line
import { booleanPointOnLine } from "@turf/boolean-point-on-line";
const result = booleanPointOnLine(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.booleanPointOnLine(...);