ol-ishare/interaction/measure

Class for assisting with making measurements on an OpenLayers map

Classes

Measure

Methods

(inner) getMeasurementFeatures(sourceOrCollection) → {Array.<ol/Feature>}

Extracts features with measurements from vector Source object, OpenLayers collection

Parameters:
Name Type Description
sourceOrCollection Array.<ol/Source/Vector> | ol/Collection.<ol/Feature>

Vector source or collection of features

Returns:

All features found with measurements

Type
Array.<ol/Feature>

(inner) clearMeasurementFeatures(sourceOrCollection) → {Array.<ol/Feature>}

Removes features with measurements from vector Source object, OpenLayers collection

Parameters:
Name Type Description
sourceOrCollection Array.<ol/Source/Vector> | ol/Collection.<ol/Feature>

Vector source or collection of features

Returns:

removed features

Type
Array.<ol/Feature>

(inner) generateMeasurementText(feature, formattersopt) → {ol/style/Text~Text}

Creates an OpenLayers text style object containing a formatted measurement value placed in the middle of the feature's geometry (or nearest internal point)

Parameters:
Name Type Attributes Description
feature ol/Feature

Feature for which to calculate and update with measurements

formatters Object <optional>

Optional object for overriding default text formatting functions

Properties
Name Type Attributes Description
area function <optional>

Turn area numeric value into text. Defaults to module:ol-ishare/interaction/measure~Measure.formatArea

length function <optional>

Turn length numeric value into text. Defaults to module:ol-ishare/interaction/measure~Measure.formatLength

Returns:

Text style object containing static text property for measurement

Type
ol/style/Text~Text