@turf/mask
TypeScript icon, indicating that this package has built-in type declarations

6.5.0 • Public • Published

@turf/mask

mask

Takes any type of polygon and an optional mask and returns a polygon exterior ring with holes.

Parameters

Examples

var polygon = turf.polygon([
  [
    [112, -21],
    [116, -36],
    [146, -39],
    [153, -24],
    [133, -10],
    [112, -21],
  ],
]);
var mask = turf.polygon([
  [
    [90, -55],
    [170, -55],
    [170, 10],
    [90, 10],
    [90, -55],
  ],
]);

var masked = turf.mask(polygon, mask);

//addToMap
var 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 module individually:

$ npm install @turf/mask

Or install the Turf module that includes it as a function:

$ npm install @turf/turf

Dependents (13)

Package Sidebar

Install

npm i @turf/mask

Weekly Downloads

389,476

Version

6.5.0

License

MIT

Unpacked Size

9.68 kB

Total Files

7

Last publish

Collaborators

  • twelch
  • jamesmilneruk
  • rowanwins
  • tmcw
  • morganherlocker
  • tcql
  • mdfedderly