@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
33 lines (32 loc) • 2.3 kB
TypeScript
import { Feature, MultiPolygon, Polygon, FeatureCollection, GeoJsonProperties } from "../types/geojson.js";
/**
* Performs one of 4 different clip operations on features
* @param features - FeatureCollection of Polygons or MultiPolygons. First feature is the subject, the rest are the clippers
* @param operation - one of "union", "intersection", "xor", "difference"
* @param options - optional properties to set on the resulting feature
* @returns clipped Feature of Polygon or MultiPolygon
*/
export declare function clip<P extends GeoJsonProperties | undefined = GeoJsonProperties>(features: FeatureCollection<Polygon | MultiPolygon>, operation: "union" | "intersection" | "xor" | "difference", options?: {
properties?: P;
}): Feature<Polygon | MultiPolygon> | null;
/**
* Performs clip after first merging features2 coords into a single multipolygon.
* Avoids errors in underlying clipping library when too many features in features2
* @param feature1 polygon or multipolygon to clip
* @param features2 collection of polygons or multipolygons to clip feature1 against
* @param operation one of "union", "intersection", "xor", "difference"
* @param options.properties properties to set on the resulting feature
* @returns polygon or multipolygon feature result from clip operation, if no overlap then returns null
*/
export declare function clipMultiMerge<P extends GeoJsonProperties | undefined = GeoJsonProperties>(feature1: Feature<Polygon | MultiPolygon>, features2: FeatureCollection<Polygon | MultiPolygon>, operation: "union" | "intersection" | "xor" | "difference", options?: {
properties?: P;
}): Feature<Polygon | MultiPolygon> | null;
/**
* Calculates area overlap between a feature A and a feature array B.
* Intersection is done in chunks on featuresB to avoid errors due to too many features
* @param featureA single feature to intersect with featuresB
* @param featuresB array of features
* @param chunkSize Size of array to split featuresB into, avoids intersect failure due to large array)
* @returns intersection of featureA with featuresB
*/
export declare const intersectInChunks: (featureA: Feature<Polygon | MultiPolygon>, featuresB: Feature<Polygon | MultiPolygon>[], chunkSize: number) => Feature<Polygon | MultiPolygon, GeoJsonProperties>[];