Skip to content

KBE3D / KBCore / turf / booleanPointOnLine

函数: booleanPointOnLine()

booleanPointOnLine(pt: Coord, line: LineString | Feature<LineString, GeoJsonProperties>, options?: { ignoreEndVertices?: boolean; epsilon?: number; }): boolean

Function

Returns true if a point is on a line. Accepts a optional parameter to ignore the start and end vertices of the linestring.

参数

pt

Coord

GeoJSON Point

line

GeoJSON LineString

LineString | Feature<LineString, GeoJsonProperties>

options?

Optional parameters

ignoreEndVertices?

boolean

whether to ignore the start and end vertices.

epsilon?

number

Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points

返回

boolean

true/false

示例

ts
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

KBE3D @3.0.0 Copyright © 2024-present KBE3D