@turf/inside v5.0.0
@turf/inside
inside
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
pointFeature<Point> input pointpolygonFeature<(Polygon | MultiPolygon)> input polygon or multipolygonoptionsObject Optional parameters (optional, default{})options.ignoreBoundaryboolean True if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false. (optional, defaultfalse)
Examples
var pt = turf.point([-77, 44]);
var poly = turf.polygon([[
[-81, 41],
[-81, 47],
[-72, 47],
[-72, 41],
[-81, 41]
]]);
turf.inside(pt, poly);
//= trueReturns 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.
Installation
Install this module individually:
$ npm install @turf/insideOr install the Turf module that includes it as a function:
$ npm install @turf/turf8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago