Geoportal Extension for OpenLayers 3 API Reference

Class: GeoportalMousePosition

ol.control.GeoportalMousePosition

MousePosition Control.

new GeoportalMousePosition(options)

Ol3/Controls/MousePosition.js, line 99
Name Type Description
options Object

options for function call.

Name Type Default Description
apiKey Sting optional

API key, mandatory if autoconf service has not been charged in advance

collapsed Boolean true optional

Specify if MousePosition control should be collapsed at startup. Default is true.

systems Array optional

list of projection systems, default are Geographical ("EPSG:4326"), Web Mercator ("EPSG:3857"), Lambert 93 ("EPSG:2154") and extended Lambert 2 ("EPSG:27572").
Each array element (=system) is an object with following properties :

Name Type Description
crs String

Proj4 crs alias (from proj4 defs). e.g. : "EPSG:4326". Required

label String optional

CRS label to be displayed in control. Default is crs code (e.g. "EPSG:4326")

type String

CRS units type for coordinates conversion : "Geographical" or "Metric". Default: "Metric"

geoBBox Object optional

Aera covered by the system (WGS84 coordinates).

Name Type Description
right Number

Right bound.

left Number

Left bound.

top Number

Top bound.

bottom Number

Bottom bound.

units Array optional

list of coordinates units, to be displayed in control units list.
Values may be "DEC" (decimal degrees), "DMS" (sexagecimal), "RAD" (radians) and "GON" (grades) for geographical coordinates,
and "M" or "KM" for metric coordinates

displayAltitude Array true optional

activate (true) or deactivate (false) the altitude panel. True by default

displayCoordinates Array true optional

activate (true) or deactivate (false) the coordinates panel. True by default

editCoordinates Boolean false optional

add edit coordinates options. False by default.

positionMarker Object optional

options for position marker

Name Type Description
url String

Marker url (define in src/Ol3/Controls/Utils/Markers.js)

offset Array

Offsets in pixels used when positioning the marker towards targeted point.
The first element in the array is the horizontal offset. A positive value shifts the marker right.
The second element in the array is the vertical offset. A positive value shifts the marker down. [0,0] value positions the top-left corner of the marker image to the targeted point.
Default is offset associated to default marker image.

hide Boolean

if true, marker is not displayed, otherwise displayed (False by default.)

altitude Object optional

elevation configuration

Name Type Description
serviceOptions Object optional

options of elevation service

responseDelay Number optional

latency for altitude request, 500 ms by default

triggerDelay Number optional

immobilisation time of movement on the map to trigger the elevation calculation, 200 ms by default

noDataValue Number optional

value used for altitude service no data (default is -99999). In this case, "---m" will be displayed instead of "-99999m"

noDataValueTolerance Number optional

tolerance for no data value :
values in [noDataValue + noDataValueTolerance ; noDataValue - noDataValueTolerance] interval will not be displayed, but "---m" will be displayed instead.
Default is 90000 (no data values = [-9999 ; -189999])

Example
var MousePosition = new ol.control.GeoportalMousePosition({
     collapsed : false,
     displayCoordinates : true,
     displayAltitude : true,
     altitude : {
          triggerDelay : 100,
          responseDelay : 500,
          noDataValue : -99999,
          noDataValueTolerance : 99000,
          serviceOptions : {}
     },
     systems : [
      {
         crs : "EPSG:3857",
         label : "Web Mercator",
         type : "Metric"
       },
      {
         crs : "EPSG:4326",
         label : "Géographiques",
         type : "Geographical"
       }
     ],
     units : ["DEC", "DMS"]
});

Extends

  • ol.control.Control

Members

collapsed

{Boolean} specify if MousePosition control is collapsed (true) or not (false)

Methods

addSystems(systems)

Ol3/Controls/MousePosition.js, line 275

Set additional projection systems

Name Type Description
systems Array

Array of system object, with following properties :

Name Type Description
crs String

Proj4 CRS alias (from proj4 defs) e.g. "EPSG:4326"

label String

CRS label (for coordinates conversion)

type String

CRS units type to be displayed in control (one of control options.units). Default is "Metric"

displayAltitude(displayAltitude)

Ol3/Controls/MousePosition.js, line 395

Display or hide elevation panel

Name Type Description
displayAltitude Boolean

true to display elevation panel, false to hide it

displayCoordinates(displayCoordinates)

Ol3/Controls/MousePosition.js, line 411

Display or hide coordinates panel

Name Type Description
displayCoordinates Boolean

true to display coordinates panel, false to hide it

removeSystem(systemCrs)

Ol3/Controls/MousePosition.js, line 293

Remove projection system (in case there are several system with same code, only the first one will be removed)

Name Type Description
systemCrs String

CRS alias (from proj4 defs)

setAltitudeOptions(options)

Ol3/Controls/MousePosition.js, line 375

Set control altitude options (useless if displayAltitude == false)

Name Type Description
options Object

altitude options

Name Type Description
serviceOptions Object optional

options of elevation service

responseDelay Number optional

latency for elevation request, 500 ms by default

triggerDelay Number optional

immobilisation time of movement on the map to trigger the elevation calculation, 200 ms by default

setCollapsed(collapsed)

Ol3/Controls/MousePosition.js, line 425

Collapse or display control main container

Name Type Description
collapsed Boolean

True to collapse control, False to display it

setMap()

Ol3/Controls/MousePosition.js, line 143

Overload ol.control.Control setMap method, called when

setUnits(units)

Ol3/Controls/MousePosition.js, line 355

Set control units (to be displayed)

Name Type Description
units Array

list of all coordinates units, to be displayed in control units list.
Values may be "DEC" (decimal degrees), "DMS" (sexagecimal), "RAD" (radians) and "GON" (grades) for geographical coordinates,
and "M" or "KM" for metric coordinates