UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

149 lines 3.32 kB
import { genSampleSketch, genSampleSketchCollection, genSampleSketchCollectionFromSketches, } from "../../helpers/index.js"; /** * Zero polygon geometry sketch. Generated by functions like clipToGeography in place of creating a null geometry */ const zero = genSampleSketch({ type: "Polygon", coordinates: [ [ [0, 0], [0, 0], [0, 0], ], ], }); const outer = genSampleSketch({ type: "Polygon", coordinates: [ [ [0, 0], [0, 20], [20, 20], [20, 0], [0, 0], ], ], }); const bottomLeftPoly = genSampleSketch({ type: "Polygon", coordinates: [ [ [2, 2], [2, 8], [8, 8], [8, 2], [2, 2], ], ], }); const topRightPoly = genSampleSketch({ type: "Polygon", coordinates: [ [ [12, 12], [12, 18], [18, 18], [18, 12], [12, 12], ], ], }); const twoPolyInsideFC = { type: "FeatureCollection", features: [bottomLeftPoly, topRightPoly], }; const twoPolyInsideSC = genSampleSketchCollection(twoPolyInsideFC); const wholePoly = genSampleSketch({ type: "Polygon", coordinates: [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], ], }); const wholeMultipoly = genSampleSketch({ type: "MultiPolygon", coordinates: [ [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], ], ], }); const wholeMixedFC = { type: "FeatureCollection", features: [wholePoly, wholeMultipoly], }; const wholeMixedSC = genSampleSketchCollection(wholeMixedFC); // hole in bottom left const holeBlPoly = genSampleSketch({ type: "Polygon", coordinates: [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], [ [2, 2], [2, 8], [8, 8], [8, 2], [2, 2], ], ], }, "holeBotLeft"); // hole in top right const holeTrMultipoly = genSampleSketch({ type: "MultiPolygon", coordinates: [ [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], [ [12, 12], [12, 18], [18, 18], [18, 12], [12, 12], ], ], ], }, "holeTopRight"); /** * Sketch collection with a whole polygon with a hole in the bottom left and a whole multipolygon with a hole in the top-right * These two features have 100% overlap except for their holes which don't overlap at all. */ const holeMixedSC = genSampleSketchCollectionFromSketches([holeBlPoly, holeTrMultipoly], "holeSC"); export default { zero, outer, bottomLeftPoly, topRightPoly, twoPolyInsideFC, twoPolyInsideSC, wholePoly, wholeMultipoly, wholeMixedFC, wholeMixedSC, holeBlPoly, holeTrMultipoly, holeMixedSC, }; //# sourceMappingURL=sketches.js.map