Measurements Helper Mode
The Measurements Helper Mode provides tools to display live measurements such as distance, area, and perimeter for various shapes during map editing. This mode works with different shape types to dynamically calculate and display measurements as users draw or modify features.
You can enable Measurements Helper Mode with the following method:
map.gm.enableMode('helper', 'measurements');
map.gm.disableMode('helper', 'measurements');
map.gm.toggleMode('helper', 'measurements');
map.gm.isModeEnabled('helper', 'measurements');
Events for Measurements Helper Mode
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
gm:globalmeasurementmodetoggled | event | Fired when Measurements Helper Mode is toggled. | enabled , map |
Example Usage
You can listen for specific Measurements Helper Mode events on the map instance like this:
map.on('gm:globalmeasurementmodetoggled', (event) => {
console.log(event);
});
Behavior
Measurements can be calculated for the following shape types:
- Markers
- Lines
- Rectangles
- Polygons
- Circles
The helper dynamically:
- Calculates distances, areas, and perimeters for shapes.
- Updates these measurements in real-time as the shape is drawn or modified.
- Displays the information in an interactive popup.