index.d.ts 1.2 KB

1234567891011121314151617181920212223242526
  1. import { Polygon, MultiPolygon, Feature, FeatureCollection } from 'geojson';
  2. /**
  3. * Takes polygons or multipolygons and an optional mask, and returns an exterior
  4. * ring polygon with holes.
  5. *
  6. * @function
  7. * @param {Polygon|MultiPolygon|Feature<Polygon|MultiPolygon>|FeatureCollection<Polygon|MultiPolygon>} polygon GeoJSON polygon used as interior rings or holes
  8. * @param {Polygon|Feature<Polygon>} [mask] GeoJSON polygon used as the exterior ring (if undefined, the world extent is used)
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {boolean} [options.mutate=false] allows the `mask` GeoJSON input to be mutated (performance improvement if true)
  11. * @returns {Feature<Polygon>} Masked Polygon (exterior ring with holes)
  12. * @example
  13. * const polygon = turf.polygon([[[112, -21], [116, -36], [146, -39], [153, -24], [133, -10], [112, -21]]]);
  14. * const mask = turf.polygon([[[90, -55], [170, -55], [170, 10], [90, 10], [90, -55]]]);
  15. *
  16. * const masked = turf.mask(polygon, mask);
  17. *
  18. * //addToMap
  19. * const addToMap = [masked]
  20. */
  21. declare function mask<T extends Polygon | MultiPolygon>(polygon: T | Feature<T> | FeatureCollection<T>, mask?: Polygon | Feature<Polygon>, options?: {
  22. mutate?: boolean;
  23. }): Feature<Polygon>;
  24. export { mask as default, mask };