@mapgear/geoapps > Measurements
Measurements class
Provides access to the measurement functionality of GeoApps. Can be accessed through the Map.Measurements
-property.
export declare class Measurements
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Measurements
class.
Example
Below is a sample how to perform a line measurement in the map:
// Initialize GeoApps and get a map in a div with id `map`
geoapps.Initialize("<tenantUrl>");
map = geoapps.AddMap("map", "<mapId");
// Bind to the measurement finished event to get the measurement result
map.Measurements.onMeasurementFinished.add((result) => {
// Log the result of the measurement
console.log(result.MeasurementResult;)
});
// Start the measurement of a linestring
map.Measurements.StartMeasurement("LineString");
Events
Property | Modifiers | Type | Description |
---|---|---|---|
onFinished | readonly | GAEvent<MeasurementFinishedEventArgs> | Triggers when the measurement is completed. |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
IsActive | readonly | boolean | Indicates whether a measurement is active or not |
Result | readonly | MeasurementResult | Returns the results of the latest active measurement. |
Methods
Method | Modifiers | Description |
---|---|---|
ResetMeasurement() | Stop the measurement and restart a measurement action of the same type. | |
StartMeasurement(measurementType) | Start a new measurement action of the specified type. | |
StopMeasurement() | Stop the current measurement action. If a measurement is in progress, cancel it. Otherwise clear all the results. |