gi-nx / getUserDrawnLineString
ts
function getUserDrawnLineString(): Promise<{
geometry: {
coordinates: [number, number][];
type: "LineString";
};
properties: Record<string, any>;
type: "Feature";
}>;Prompt the user to draw a line on the map. The promise resolves once the user completes the line (double-click or Enter), or undefined if cancelled. Hold 's' to snap to nearby features.
Returns
Promise<{ geometry: { coordinates: [number, number][]; type: "LineString"; }; properties: Record<string, any>; type: "Feature"; }>
The drawn line, or undefined if cancelled.
Example
typescript
const line = await rpc.invoke("getUserDrawnLineString", []);
if (line) {
console.log("Drawn line:", line.geometry.coordinates);
}