@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
35 lines (34 loc) • 2.23 kB
TypeScript
import { Sketch, SketchCollection, Polygon, Feature, Metric } from "../types/index.js";
import { MultiPolygon } from "../types/geojson.js";
/**
* Calculates area overlap between sketch(es) and an array of polygon features.
* Truncates input geometry coordinates down to 6 decimal places (~1m accuracy) before intersection to avoid floating point precision issues.
* If sketch collection, then calculates area per sketch and for sketch collection
* @param metricId unique metric identifier to assign to each metric
* @param features to intersect and get overlap metrics
* @param sketch the sketches. If empty will return 0 result.
* @param options.truncate truncate results to 6 digits after decimal point, defaults to true
* @param options.includeChildMetrics if false and sketch is collection, child sketch metrics will not be included in results, defaults to true
* @param options.sumProperty Property in features with value to sum, if not defined each feature will count as 1
* @returns array of Metric objects
*/
export declare function overlapPolygonSum(metricId: string, features: Feature<Polygon | MultiPolygon>[], sketch: Sketch<Polygon | MultiPolygon> | SketchCollection<Polygon | MultiPolygon> | Sketch<Polygon | MultiPolygon>[], options?: {
truncate?: boolean;
includeChildMetrics?: boolean;
sumProperty?: string;
}): Promise<Metric[]>;
/**
* Returns an object containing the sum value of features in B that intersect with featureA,
* and the indices of the features in B that intersect with featureA
* No support for partial overlap, counts the whole feature if it intersects.
* @param featureA single feature to intersect with featuresB
* @param featuresB array of features
* @param sumProperty Property in featuresB with value to sum, if not defined each feature will count as 1
* @returns Sum of features/feature property which overlap with the sketch, and a list of
* indices for features that overlap with the sketch to be used in calculating total sum of
* the sketch collection
*/
export declare const intersectSum: (featureA: Feature<Polygon | MultiPolygon>, featuresB: Feature<Polygon | MultiPolygon>[], sumProperty?: string) => {
sum: number;
indices: number[];
};