Skip to main content
Version: Next

overlapPolygonArea()

function overlapPolygonArea(
metricId,
features,
sketch,
options): Promise<Metric[]>

Calculates area of 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 for each child sketch and the whole collection, without overcounting sketch overlap

Parameters

ParameterTypeDescription
metricIdstringunique metric identifier to assign to each metric
featuresFeature<Polygon | MultiPolygon, GeoJsonProperties>[]to intersect and get overlap metrics
sketchSketchCollection<Polygon | MultiPolygon> | Sketch<Polygon | MultiPolygon> | Sketch<Polygon | MultiPolygon>[]the sketches. If empty will return 0 result.
optionsobject-
options.chunkSize?numbernumber of features to intersect at a time, to avoid infinite loop error, defaults to 5000 features
options.includeChildMetrics?booleanif false and sketch is collection, child sketch metrics will not be included in results, defaults to true
options.solveOverlap?booleanif true and sketch is collection, remove overlap between child sketches (using union) before calculating collection level metric, setting to false will be faster but will overcount any sketch overlap
options.truncate?booleantruncate results to 6 digits after decimal point, defaults to true

Returns

Promise<Metric[]>

array of Metric objects