UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

45 lines (44 loc) 2.96 kB
import { Sketch, SketchCollection, Feature, MultiPolygon, Polygon, Metric } from "../types/index.js"; /** * Assuming sketches are within some outer boundary with size outerArea, * calculates metric for both the area of each sketch and the percentage of outerArea they take up. * If sketch is a collection, will return metrics for each child sketch as well as the collection * collection level metric will calculated by unioning child sketches to remove overlap. * If collection level calculation produces an "Unable to complete output ring" error, it * will fallback to simplify the sketch with simplifyTolerance (default to .0000001 if not passed) and try again. * @deprecated use overlapFeatures (numerators) + precalculated metrics (denominators) + toPercentMetric */ export declare function overlapArea( /** Metric identifier */ metricId: string, /** single sketch or collection. */ sketch: Sketch<Polygon> | SketchCollection<Polygon>, /** area of outer boundary (e.g. planning area) */ outerArea: number, options?: { /** If sketch collection, will include its child sketch metrics in addition to collection metrics, defaults to true */ includeChildMetrics?: boolean; /** Includes metrics with percent of total area, in addition to raw area value metrics, defaults to true */ includePercMetric?: boolean; /** tolerance to simplify sketch coordinates in degrees. If provided, all sketches will be simplified with it, in order to avoid error when clipping. */ simplifyTolerance?: number; }): Promise<Metric[]>; /** * Returns area stats for sketch input after performing overlay operation against a subarea feature. * Includes both area overlap and percent area overlap metrics, because calculating percent later would be too complicated * For sketch collections, dissolve is used when calculating total sketch area to prevent double counting * @deprecated - using geographies will clip your datasources and you can just use overlapFeatures. This will be removed in a future version */ export declare function overlapSubarea( /** Metric identifier */ metricId: string, /** Single sketch or collection */ sketch: Sketch<Polygon> | SketchCollection<Polygon>, /** subarea feature */ subareaFeature: Feature<Polygon | MultiPolygon>, options?: { /** operation to perform on sketch in relation to sub area features, defaults to 'intersection' */ operation?: "intersection" | "difference"; /** area of outer boundary. Use for total area of the subarea for intersection when you don't have the whole feature, or use for the total area of the boundar outside of the subarea for difference (typically EEZ or planning area) */ outerArea?: number | undefined; /** simplify sketches with tolerance in degrees. .000001 is a good first value to try. only used for calculating area of collection (avoiding clip union to remove overlap blowing up) */ simplifyTolerance?: number; }): Promise<Metric[]>;