OpenLayers. Control. Measure

Allows for drawing of features for measurements.

Inherits from

Summary
OpenLayers. Control. MeasureAllows for drawing of features for measurements.
Constants
EVENT_TYPES{Array(String)} Supported application event types.
Properties
handlerOptions{Object} Used to set non-default properties on the control’s handler
callbacks{Object} The functions that are sent to the handler for callback
displaySystem{String} Display system for output measurements.
displaySystemUnits{Object} Units for various measurement systems.
Constructor
OpenLayers. Control. Measure
Functions
updateHandler
measureCompleteCalled when the measurement sketch is done.
measurePartialCalled each time a new point is added to the measurement sketch.
measure
getBestAreaBased on the displaySystem returns the area of a geometry.
getArea
getBestLengthBased on the displaySystem returns the length of a geometry.
getLength

Constants

EVENT_TYPES

{Array(String)} Supported application event types.  Register a listener for a particular event with the following syntax:

control.events.register(type, obj, listener);

Listeners will be called with a reference to an event object.  The properties of this event depends on exactly what happened.

Supported control event types (in addition to those from OpenLayers.Control)

  • measure Triggered when a measurement sketch is complete.  Listeners will receive an event with measure, units, order, and geometry properties.
  • measurepartial Triggered when a new point is added to the measurement sketch.  Listeners receive an event with measure, units, order, and geometry.

Properties

handlerOptions

{Object} Used to set non-default properties on the control’s handler

callbacks

{Object} The functions that are sent to the handler for callback

displaySystem

{String} Display system for output measurements.  Supported values are ‘english’, ‘metric’, and ‘geographic’.  Default is ‘metric’.

displaySystemUnits

{Object} Units for various measurement systems.  Values are arrays of unit abbreviations (from OpenLayers.INCHES_PER_UNIT) in decreasing order of length.

Constructor

OpenLayers. Control. Measure

Parameters

handler{OpenLayers.Handler}
options{Object}

Functions

updateHandler

updateHandler: function(handler,
options)

Parameters

handler{Function} One of the sketch handler constructors.
options{Object} Options for the handler.

measureComplete

measureComplete: function(geometry)

Called when the measurement sketch is done.

Parameters

geometry{OpenLayers.Geometry}

measurePartial

measurePartial: function(point,
geometry)

Called each time a new point is added to the measurement sketch.

Parameters

point{OpenLayers.Geometry.Point} The last point added.
geometry{OpenLayers.Geometry} The sketch geometry.

measure

measure: function(geometry,
eventType)

Parameters

geometry{OpenLayers.Geometry}
eventType{String}

getBestArea

getBestArea: function(geometry)

Based on the displaySystem returns the area of a geometry.

Parameters

geometry{OpenLayers.Geometry}

Returns

{Array([Float, String])} Returns a two item array containing the area and the units abbreviation.

getArea

getArea: function(geometry,
units)

Parameters

geometry{OpenLayers.Geometry}
units{String} Unit abbreviation

Returns

{Float} The geometry area in the given units.

getBestLength

getBestLength: function(geometry)

Based on the displaySystem returns the length of a geometry.

Parameters

geometry{OpenLayers.Geometry}

Returns

{Array([Float, String])} Returns a two item array containing the length and the units abbreviation.

getLength

getLength: function(geometry,
units)

Parameters

geometry{OpenLayers.Geometry}
units{String} Unit abbreviation

Returns

{Float} The geometry length in the given units.

updateHandler: function(handler,
options)
measureComplete: function(geometry)
Called when the measurement sketch is done.
measurePartial: function(point,
geometry)
Called each time a new point is added to the measurement sketch.
measure: function(geometry,
eventType)
getBestArea: function(geometry)
Based on the displaySystem returns the area of a geometry.
{String} Display system for output measurements.
getArea: function(geometry,
units)
getBestLength: function(geometry)
Based on the displaySystem returns the length of a geometry.
getLength: function(geometry,
units)
Controls affect the display or behavior of the map.
Base class to construct a higher-level handler for event sequences.
A Geometry is a description of a geographic object.
Point geometry class.
Close