Skip to content

gi-nx


gi-nx / getUserDrawnPoint

ts
function getUserDrawnPoint(): Promise<{
  geometry: {
     coordinates: [number, number];
     type: "Point";
  };
  properties: Record<string, any>;
  type: "Feature";
}>;

Prompt the user to place a point on the map. The promise resolves once the user clicks to place the point, or undefined if cancelled. Hold 's' to snap to nearby features.

Returns ​

Promise<{ geometry: { coordinates: [number, number]; type: "Point"; }; properties: Record<string, any>; type: "Feature"; }>

The drawn point, or undefined if cancelled.

Example ​

typescript
const point = await rpc.invoke("getUserDrawnPoint", []);
if (point) {
  console.log("Drawn point:", point.geometry.coordinates);
}