Namespaces
Type Definitions
-
olx.AnimationOptions{Object}
-
Properties:
Name Type Argument Description center
ol.Coordinate | undefined <optional>
The center of the view at the end of the animation.
zoom
number | undefined <optional>
The zoom level of the view at the end of the animation. This takes precedence over
resolution
.resolution
number | undefined <optional>
The resolution of the view at the end of the animation. If
zoom
is also provided, this option will be ignored.rotation
number | undefined <optional>
The rotation of the view at the end of the animation.
anchor
ol.Coordinate | undefined <optional>
Optional anchor to remained fixed during a rotation or resolution animation.
duration
number | undefined <optional>
The duration of the animation in milliseconds (defaults to
1000
).easing
undefined | function <optional>
The easing function used during the animation (defaults to
ol.easing.inAndOut
). The function will be called for each frame with a number representing a fraction of the animation's duration. The function should return a number between 0 and 1 representing the progress toward the destination state. -
olx.AtPixelOptions{Object}
-
Object literal with options for the
ol.Map#forEachFeatureAtPixel
andol.Map#hasFeatureAtPixel
methods.Properties:
Name Type Argument Description layerFilter
function | undefined <optional>
Layer filter function. The filter function will receive one argument, the
layer-candidate
and it should return a boolean value. Only layers which are visible and for which this function returnstrue
will be tested for features. By default, all visible layers will be tested.hitTolerance
number | undefined <optional>
Hit-detection tolerance in pixels. Pixels inside the radius around the given position will be checked for features. This only works for the canvas renderer and not for WebGL. Default is
0
. -
olx.AttributionOptions{Object}
-
Properties:
Name Type Description html
string HTML markup for this attribution. Required.
-
olx.CollectionOptions{Object}
-
Properties:
Name Type Argument Description unique
boolean | undefined <optional>
Disallow the same item from being added to the collection twice. Default is false.
-
olx.DeviceOrientationOptions{Object}
-
Properties:
Name Type Argument Description tracking
boolean | undefined <optional>
Start tracking. Default is
false
. -
olx.FrameState{Object}
-
Properties:
Name Type Description pixelRatio
number Required.
time
number Required.
viewState
olx.ViewState Required.
-
olx.GeolocationOptions{Object}
-
Properties:
Name Type Argument Description tracking
boolean | undefined <optional>
Start Tracking. Default is
false
.trackingOptions
GeolocationPositionOptions | undefined <optional>
Tracking options. See http://www.w3.org/TR/geolocation-API/#position_options_interface.
projection
ol.ProjectionLike The projection the position is reported in.
-
olx.GraticuleOptions{Object}
-
Properties:
Name Type Argument Description map
ol.PluggableMap | undefined <optional>
Reference to an
ol.Map
object.maxLines
number | undefined <optional>
The maximum number of meridians and parallels from the center of the map. The default value is 100, which means that at most 200 meridians and 200 parallels will be displayed. The default value is appropriate for conformal projections like Spherical Mercator. If you increase the value more lines will be drawn and the drawing performance will decrease.
strokeStyle
ol.style.Stroke | undefined <optional>
The stroke style to use for drawing the graticule. If not provided, the lines will be drawn with
rgba(0,0,0,0.2)
, a not fully opaque black.targetSize
number | undefined <optional>
The target size of the graticule cells, in pixels. Default value is 100 pixels.
showLabels
boolean | undefined <optional>
Render a label with the respective latitude/longitude for each graticule line. Default is false.
lonLabelFormatter
undefined | function <optional>
Label formatter for longitudes. This function is called with the longitude as argument, and should return a formatted string representing the longitude. By default, labels are formatted as degrees, minutes, seconds and hemisphere.
latLabelFormatter
undefined | function <optional>
Label formatter for latitudes. This function is called with the latitude as argument, and should return a formatted string representing the latitude. By default, labels are formatted as degrees, minutes, seconds and hemisphere.
lonLabelPosition
number | undefined <optional>
Longitude label position in fractions (0..1) of view extent. 0 means at the bottom of the viewport, 1 means at the top. Default is 0.
latLabelPosition
number | undefined <optional>
Latitude label position in fractions (0..1) of view extent. 0 means at the left of the viewport, 1 means at the right. Default is 1.
lonLabelStyle
ol.style.Text | undefined <optional>
Longitude label text style. The default is
new ol.style.Text({ font: '12px Calibri,sans-serif', textBaseline: 'bottom', fill: new ol.style.Fill({ color: 'rgba(0,0,0,1)' }), stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,1)', width: 3 }) });
Note that the default's
textBaseline
configuration will not work well forlonLabelPosition
configurations that position labels close to the top of the viewport.latLabelStyle
ol.style.Text | undefined <optional>
Latitude label text style. The default is
new ol.style.Text({ font: '12px Calibri,sans-serif', textAlign: 'end', fill: new ol.style.Fill({ color: 'rgba(0,0,0,1)' }), stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,1)', width: 3 }) });
Note that the default's
textAlign
configuration will not work well forlatLabelPosition
configurations that position labels close to the left of the viewport. -
olx.LayerRendererPlugin{Object}
-
Properties:
Name Type Description handles
function Determine if this renderer handles the provided layer. Required.
create
function Create a layer renderer. Required.
-
olx.LogoOptions{Object}
-
Object literal with config options for the map logo.
Properties:
Name Type Description href
string Link url for the logo. Will be followed when the logo is clicked. Required.
src
string Image src for the logo. Required.
-
olx.MapOptions{Object}
-
Object literal with config options for the map.
Properties:
Name Type Argument Description controls
ol.Collection.<ol.control.Control> | Array.<ol.control.Control> | undefined <optional>
Controls initially added to the map. If not specified,
ol.control.defaults()
is used.pixelRatio
number | undefined <optional>
The ratio between physical pixels and device-independent pixels (dips) on the device. If
undefined
then it gets set by usingwindow.devicePixelRatio
.interactions
ol.Collection.<ol.interaction.Interaction> | Array.<ol.interaction.Interaction> | undefined <optional>
Interactions that are initially added to the map. If not specified,
ol.interaction.defaults()
is used.keyboardEventTarget
Element | Document | string | undefined <optional>
The element to listen to keyboard events on. This determines when the
KeyboardPan
andKeyboardZoom
interactions trigger. For example, if this option is set todocument
the keyboard interactions will always trigger. If this option is not specified, the element the library listens to keyboard events on is the map target (i.e. the user-provided div for the map). If this is notdocument
the target element needs to be focused for key events to be emitted, requiring that the target element has atabindex
attribute.layers
Array.<ol.layer.Base> | ol.Collection.<ol.layer.Base> | undefined <optional>
Layers. If this is not defined, a map with no layers will be rendered. Note that layers are rendered in the order supplied, so if you want, for example, a vector layer to appear on top of a tile layer, it must come after the tile layer.
loadTilesWhileAnimating
boolean | undefined <optional>
When set to true, tiles will be loaded during animations. This may improve the user experience, but can also make animations stutter on devices with slow memory. Default is
false
.loadTilesWhileInteracting
boolean | undefined <optional>
When set to true, tiles will be loaded while interacting with the map. This may improve the user experience, but can also make map panning and zooming choppy on devices with slow memory. Default is
false
.logo
boolean | string | olx.LogoOptions | Element | undefined <optional>
The map logo. A logo to be displayed on the map at all times. If a string is provided, it will be set as the image source of the logo. If an object is provided, the
src
property should be the URL for an image and thehref
property should be a URL for creating a link. If an element is provided, the element will be used. To disable the map logo, set the option tofalse
. By default, the OpenLayers logo is shown.moveTolerance
number | undefined <optional>
The minimum distance in pixels the cursor must move to be detected as a map move event instead of a click. Increasing this value can make it easier to click on the map. Default is
1
.overlays
ol.Collection.<ol.Overlay> | Array.<ol.Overlay> | undefined <optional>
Overlays initially added to the map. By default, no overlays are added.
renderer
ol.renderer.Type | Array.<ol.renderer.Type> | undefined <optional>
Renderer. By default, Canvas and WebGL renderers are tested for support in that order, and the first supported used. Specify a
ol.renderer.Type
here to use a specific renderer. Note that the Canvas renderer fully supports vector data, but WebGL can only render Point geometries.target
Element | string | undefined <optional>
The container for the map, either the element itself or the
id
of the element. If not specified at construction time,ol.Map#setTarget
must be called for the map to be rendered.view
ol.View | undefined <optional>
The map's view. No layer sources will be fetched unless this is specified at construction time or through
ol.Map#setView
. -
olx.MapRendererPlugin{Object}
-
Properties:
Name Type Description handles
function Determine if this renderer handles the provided layer. Required.
create
function Create the map renderer. Required.
-
olx.OverlayOptions{Object}
-
Object literal with config options for the overlay.
Properties:
Name Type Argument Description id
number | string | undefined <optional>
Set the overlay id. The overlay id can be used with the
ol.Map#getOverlayById
method.element
Element | undefined <optional>
The overlay element.
offset
Array.<number> | undefined <optional>
Offsets in pixels used when positioning the overlay. The first element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is
[0, 0]
.position
ol.Coordinate | undefined <optional>
The overlay position in map projection.
positioning
ol.OverlayPositioning | string | undefined <optional>
Defines how the overlay is actually positioned with respect to its
position
property. Possible values are'bottom-left'
,'bottom-center'
,'bottom-right'
,'center-left'
,'center-center'
,'center-right'
,'top-left'
,'top-center'
, and'top-right'
. Default is'top-left'
.stopEvent
boolean | undefined <optional>
Whether event propagation to the map viewport should be stopped. Default is
true
. Iftrue
the overlay is placed in the same container as that of the controls (CSS class nameol-overlaycontainer-stopevent
); iffalse
it is placed in the container with CSS class nameol-overlaycontainer
.insertFirst
boolean | undefined <optional>
Whether the overlay is inserted first in the overlay container, or appended. Default is
true
. If the overlay is placed in the same container as that of the controls (see thestopEvent
option) you will probably setinsertFirst
totrue
so the overlay is displayed below the controls.autoPan
boolean | undefined <optional>
If set to
true
the map is panned when callingsetPosition
, so that the overlay is entirely visible in the current viewport. The default isfalse
.autoPanAnimation
olx.OverlayPanOptions | undefined <optional>
The animation options used to pan the overlay into view. This animation is only used when
autoPan
is enabled. Aduration
andeasing
may be provided to customize the animation.autoPanMargin
number | undefined <optional>
The margin (in pixels) between the overlay and the borders of the map when autopanning. The default is
20
.className
string | undefined <optional>
CSS class name. Default is
ol-overlay-container ol-selectable
. -
olx.OverlayPanOptions{Object}
-
Properties:
Name Type Description duration
number | undefined The duration of the animation in milliseconds. Default is
1000
.easing
undefined | function The easing function to use. Can be an
ol.easing
or a custom function. Default isol.easing.inAndOut
. -
olx.ProjectionOptions{Object}
-
Object literal with config options for the projection.
Properties:
Name Type Argument Description code
string The SRS identifier code, e.g.
EPSG:4326
. Required.units
ol.proj.Units | string | undefined <optional>
Units. Required unless a proj4 projection is defined for
code
.extent
ol.Extent | undefined <optional>
The validity extent for the SRS.
axisOrientation
string | undefined <optional>
The axis orientation as specified in Proj4. The default is
enu
.global
boolean | undefined <optional>
Whether the projection is valid for the whole globe. Default is
false
.metersPerUnit
number | undefined <optional>
The meters per unit for the SRS. If not provided, the
units
are used to get the meters per unit from theol.proj.METERS_PER_UNIT
lookup table.worldExtent
ol.Extent | undefined <optional>
The world extent for the SRS.
getPointResolution
function | undefined <optional>
Function to determine resolution at a point. The function is called with a
{number}
view resolution and an{ol.Coordinate}
as arguments, and returns the{number}
resolution at the passed coordinate. If this isundefined
, the defaultol.proj#getPointResolution
function will be used. -
olx.SphereMetricOptions{Object}
-
Object literal with options for the
ol.Sphere.getLength
orol.Sphere.getArea
functions.Properties:
Name Type Argument Description projection
ol.ProjectionLike | undefined <optional>
Projection of the geometry. By default, the geometry is assumed to be in EPSG:3857 (Web Mercator).
radius
number | undefined <optional>
Sphere radius. By default, the radius of the earth is used (Clarke 1866 Authalic Sphere).
-
olx.TileOptions{Object}
-
Options for tile constructors.
Properties:
Name Type Description transition
number | undefined A duration for tile opacity transitions. By default, tiles will render with an opacity transition that lasts 250 ms. To change the duration, pass a number in milliseconds. A duration of 0 disables the opacity transition.
-
olx.ViewOptions{Object}
-
Object literal with config options for the view.
Properties:
Name Type Argument Description center
ol.Coordinate | undefined <optional>
The initial center for the view. The coordinate system for the center is specified with the
projection
option. Default isundefined
, and layer sources will not be fetched if this is not set.constrainRotation
boolean | number | undefined <optional>
Rotation constraint.
false
means no constraint.true
means no constraint, but snap to zero near zero. A number constrains the rotation to that number of values. For example,4
will constrain the rotation to 0, 90, 180, and 270 degrees. The default istrue
.enableRotation
boolean | undefined <optional>
Enable rotation. Default is
true
. Iffalse
a rotation constraint that always sets the rotation to zero is used. TheconstrainRotation
option has no effect ifenableRotation
isfalse
.extent
ol.Extent | undefined <optional>
The extent that constrains the center, in other words, center cannot be set outside this extent. Default is
undefined
.maxResolution
number | undefined <optional>
The maximum resolution used to determine the resolution constraint. It is used together with
minResolution
(ormaxZoom
) andzoomFactor
. If unspecified it is calculated in such a way that the projection's validity extent fits in a 256x256 px tile. If the projection is Spherical Mercator (the default) thenmaxResolution
defaults to40075016.68557849 / 256 = 156543.03392804097
.minResolution
number | undefined <optional>
The minimum resolution used to determine the resolution constraint. It is used together with
maxResolution
(orminZoom
) andzoomFactor
. If unspecified it is calculated assuming 29 zoom levels (with a factor of 2). If the projection is Spherical Mercator (the default) thenminResolution
defaults to40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253
.maxZoom
number | undefined <optional>
The maximum zoom level used to determine the resolution constraint. It is used together with
minZoom
(ormaxResolution
) andzoomFactor
. Default is28
. Note that ifminResolution
is also provided, it is given precedence overmaxZoom
.minZoom
number | undefined <optional>
The minimum zoom level used to determine the resolution constraint. It is used together with
maxZoom
(orminResolution
) andzoomFactor
. Default is0
. Note that ifmaxResolution
is also provided, it is given precedence overminZoom
.projection
ol.ProjectionLike The projection. Default is
EPSG:3857
(Spherical Mercator).resolution
number | undefined <optional>
The initial resolution for the view. The units are
projection
units per pixel (e.g. meters per pixel). An alternative to setting this is to setzoom
. Default isundefined
, and layer sources will not be fetched if neither this norzoom
are defined.resolutions
Array.<number> | undefined <optional>
Resolutions to determine the resolution constraint. If set the
maxResolution
,minResolution
,minZoom
,maxZoom
, andzoomFactor
options are ignored.rotation
number | undefined <optional>
The initial rotation for the view in radians (positive rotation clockwise). Default is
0
.zoom
number | undefined <optional>
Only used if
resolution
is not defined. Zoom level used to calculate the initial resolution for the view. The initial resolution is determined using theol.View#constrainResolution
method.zoomFactor
number | undefined <optional>
The zoom factor used to determine the resolution constraint. Default is
2
. -
olx.ViewState{Object}
-
Properties:
Name Type Description center
ol.Coordinate Required.
projection
ol.proj.Projection Required.
resolution
number Required.
rotation
number Required.
zoom
number The current zoom level. Required.