Skip to main content

@mapgear/geoapps > Measurements

Measurements class

Provides access to the measurement functionality of GeoApps. Can be accessed through the Map.Measurements-property.

Signature:
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

PropertyModifiersTypeDescription
onFinishedreadonlyGAEvent<MeasurementFinishedEventArgs>Triggers when the measurement is completed.

Properties

PropertyModifiersTypeDescription
IsActivereadonlybooleanIndicates whether a measurement is active or not
ResultreadonlyMeasurementResultReturns the results of the latest active measurement.

Methods

MethodModifiersDescription
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.