OpenLayers.Control.MousePosition

The MousePosition control displays geographic coordinates of the mouse pointer, as it is moved about the map.

You can use the prefix- or suffix-properties to provide more information about the displayed coordinates to the user:

var mousePositionCtrl = new OpenLayers.Control.MousePosition({
    prefix: '<a target="_blank" ' +
        'href="http://spatialreference.org/ref/epsg/4326/">' +
        'EPSG:4326</a> coordinates: '
    }
);

Inherits from

Summary
OpenLayers.Control.MousePositionThe MousePosition control displays geographic coordinates of the mouse pointer, as it is moved about the map.
Properties
autoActivate{Boolean} Activate the control when it is added to a map.
prefix{String} A string to be prepended to the current pointers coordinates when it is rendered.
separator{String} A string to be used to seperate the two coordinates from each other.
suffix{String} A string to be appended to the current pointers coordinates when it is rendered.
numDigits{Integer} The number of digits each coordinate shall have when being rendered, Defaults to 5.
granularity{Integer}
emptyString{String} Set this to some value to set when the mouse is outside the map.
displayProjection{OpenLayers.Projection} The projection in which the mouse position is displayed.
Constructor
OpenLayers.Control.MousePosition
Functions
activate
deactivate

Properties

autoActivate

{Boolean} Activate the control when it is added to a map.  Default is true.

prefix

{String} A string to be prepended to the current pointers coordinates when it is rendered.  Defaults to the empty string ‘’.

separator

{String} A string to be used to seperate the two coordinates from each other.  Defaults to the string ‘, ‘, which will result in a rendered coordinate of e.g.  ‘42.12, 21.22’.

suffix

{String} A string to be appended to the current pointers coordinates when it is rendered.  Defaults to the empty string ‘’.

numDigits

{Integer} The number of digits each coordinate shall have when being rendered, Defaults to 5.

granularity

{Integer}

emptyString

{String} Set this to some value to set when the mouse is outside the map.

displayProjection

{OpenLayers.Projection} The projection in which the mouse position is displayed.

Constructor

OpenLayers.Control.MousePosition

Parameters

options{Object} Options for control.

Functions

activate

activate: function()

deactivate

deactivate: function()
Methods for coordinate transforms between coordinate systems.
activate: function()
deactivate: function()
{String} A string to be prepended to the current pointers coordinates when it is rendered.
{String} A string to be appended to the current pointers coordinates when it is rendered.
Controls affect the display or behavior of the map.
Close