import { Sketch, SketchCollection, Polygon, MultiPolygon, GeoprocessingHandler, } from "@seasketch/geoprocessing"; import { area } from "@turf/turf"; export interface SimpleResults { /** area of sketch within geography in square meters */ area: number; } /** * Simple geoprocessing function with custom result payload */ async function simpleFunction( sketch: | Sketch | SketchCollection, ): Promise { // Add analysis code const sketchArea = area(sketch); // Custom return type return { area: sketchArea, }; } export default new GeoprocessingHandler(simpleFunction, { title: "simpleFunction", description: "Function description", timeout: 60, // seconds memory: 1024, // megabytes executionMode: "async", });