Skip to content

KBE3D / KBCore / turf / booleanPointInPolygon

函数: booleanPointInPolygon()

booleanPointInPolygon<G, P>(point: Coord, polygon: G | Feature<G, P>, options?: { ignoreBoundary?: boolean; }): boolean

Function

Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.

类型参数

G

G extends Polygon | MultiPolygon

P

P extends GeoJsonProperties = GeoJsonProperties

参数

point

Coord

input point

polygon

input polygon or multipolygon

G | Feature<G, P>

options?

Optional parameters

ignoreBoundary?

boolean

True if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false.

返回

boolean

true if the Point is inside the Polygon; false if the Point is not inside the Polygon

示例

ts
var pt = turf.point([-77, 44]);
var poly = turf.polygon([[
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41],
  [-81, 41]
]]);

turf.booleanPointInPolygon(pt, poly);
//= true

KBE3D @3.0.0 Copyright © 2024-present KBE3D