gi-nx / getUserDrawnPolygon
ts
function getUserDrawnPolygon(): Promise<{
geometry: {
coordinates: [number, number][][];
type: "Polygon";
};
properties: Record<string, any>;
type: "Feature";
}>;Prompt the user to draw a polygon on the map. The promise resolves once the user completes the polygon, or undefined if cancelled.
Returns
Promise<{ geometry: { coordinates: [number, number][][]; type: "Polygon"; }; properties: Record<string, any>; type: "Feature"; }>
The drawn polygon as a RawPolygon, or undefined if cancelled.
Example
typescript
const polygon = await rpc.invoke("getUserDrawnPolygon", []);
if (polygon) {
console.log("Drawn polygon:", polygon.geometry.coordinates);
}