booleanPointInPolygon
描述
¥Description
Takes a 点 and a 多边形 or MultiPolygon and determines if the point resides inside the polygon.The polygon can be convex or concave.The function accounts for holes.
¥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.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
point | 坐标系 | 输入点 |
polygon | 特性<多边形 | MultiPolygon> | 输入多边形或多多边形 |
options? | 对象 | 可选参数(默认 ) |
options.ignoreBoundary? | boolean | True if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false.(默认 false) |
返回
¥Returns
boolean true
if the Point is inside the Polygon;false
if the Point is not inside the Polygon
示例
¥Examples
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
安装
¥Installation
$ npm install @turf/boolean-point-in-polygon
import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
const result = booleanPointInPolygon(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.booleanPointInPolygon(...);