Package Exports
- @turf/mask
- @turf/mask/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@turf/mask) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@turf/mask
mask
Takes polygons or multipolygons and an optional mask, and returns an exterior ring polygon with holes.
Parameters
polygon(Polygon | MultiPolygon | Feature<(Polygon | MultiPolygon)> | FeatureCollection<(Polygon | MultiPolygon)>) GeoJSON polygon used as interior rings or holesmask(Polygon | Feature<Polygon>)? GeoJSON polygon used as the exterior ring (if undefined, the world extent is used)optionsObject Optional parameters (optional, default{})options.mutateboolean allows themaskGeoJSON input to be mutated (performance improvement if true) (optional, defaultfalse)
Examples
const polygon = turf.polygon([[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]);
const mask = turf.polygon([[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]);
const masked = turf.mask(polygon, mask);
//addToMap
const addToMap = [masked]Returns Feature<Polygon> Masked Polygon (exterior ring with holes)
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 single module individually:
$ npm install @turf/maskOr install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf