UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

29 lines 1.06 kB
import { isSketchCollection } from "./sketch.js"; import { bbox } from "@turf/turf"; //// Helper methods //// /** * If sketch collection passes sketchTest, then returns new collection * with mergeSketchColl sketches appended and updated bbox */ export function includeVirtualSketch(sketchColl, mergeSketchColl, sketchTest) { if (!isSketchCollection(sketchColl) || !isSketchCollection(mergeSketchColl)) { throw new Error(`Expected sketch collection for includeVirtualSketch`); } if (sketchTest(sketchColl)) { let finalSketch = sketchColl; finalSketch = { ...sketchColl, features: [...sketchColl.features, ...mergeSketchColl.features], }; console.log(bbox(finalSketch)); finalSketch.bbox = bbox(finalSketch); return finalSketch; } else { return sketchColl; } } export const isTruthyAttributeValue = (value) => { return value === "Yes" || value === "yes" || value === true ? true : false; }; //# sourceMappingURL=includeVirtualSketch.js.map