Geoportal Extension for OpenLayers API Reference

Class: MeasureLength

ol.control.MeasureLength

Length measurement Control. Allows users to draw a path on Openlayers map and have its length computed and displayed.

new MeasureLength(options)

OpenLayers/Controls/Measures/MeasureLength.js, line 46
Name Type Description
options Object

options for function call.

Name Type Default Description
geodesic Boolean true optional

If true, length will be computed on the global sphere using the ol.Sphere.haversineDistance() function. Otherwise, length will be computed on the projected plane.

styles Object {} optional

styles used when drawing. Specified with following properties.

Name Type Default Description
pointer Object {} optional

Style for mouse pointer when drawing the path. Specified with an ol.style.Image subclass object.

start Object {} optional

Line Style when drawing. Specified with an ol.style.Style object.

finish Object {} optional

Line Style when finished drawing. Specified with an ol.style.Style object.

layerDescription Object {} optional

Layer informations to be displayed in LayerSwitcher widget (only if a LayerSwitcher is also added to the map)

Name Type Default Description
title String "Mesures de distance" optional

Layer title to be displayed in LayerSwitcher

description String "Mes mesures" optional

Layer description to be displayed in LayerSwitcher

Example
var measureLength = new ol.control.MeasureLength({
   geodesic : false
});

Extends

  • ol.control.Control

Methods

setMap(map)

OpenLayers/Controls/Measures/MeasureLength.js, line 107

Overwrite OpenLayers setMap method

Name Type Description
map ol.Map

Map.