|
|
4 meses atrás | |
|---|---|---|
| .. | ||
| dist | 4 meses atrás | |
| LICENSE | 4 meses atrás | |
| README.md | 4 meses atrás | |
| package.json | 4 meses atrás | |
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.
point Coord input pointpolygon Feature<(Polygon | MultiPolygon)> input polygon or multipolygonoptions Object Optional parameters (optional, default {})
options.ignoreBoundary boolean True if polygon boundary should be ignored when determining if
the point is inside the polygon otherwise false. (optional, default false)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
Returns boolean true if the Point is inside the Polygon; false if the Point is not inside the Polygon
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/boolean-point-in-polygon
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf