Skip to content

worldwind-ui API / react-worldwind / useMeasureTool

Function: useMeasureTool() ​

useMeasureTool(options?): UseMeasureToolResult

Defined in: react/src/hooks.ts:263

A click-to-measure tool bound to the globe for the component's lifetime.

Parameters ​

options? ​

MeasureToolOptions = {}

Returns ​

UseMeasureToolResult

Example ​

tsx
const { state, toggle } = useMeasureTool();
return <button onClick={toggle}>{state.active ? 'Stop' : 'Measure'} ({formatDistance(state.lengthMeters)})</button>;

MIT licensed. Not affiliated with NASA; WorldWind is NASA's open-source virtual globe.