Type Definitions
-
olx.interaction.DefaultsOptions{Object}
-
Interactions for the map. Default is
true
for all options.Properties:
Name Type Argument Description altShiftDragRotate
boolean | undefined <optional>
Whether Alt-Shift-drag rotate is desired. Default is
true
.constrainResolution
boolean | undefined <optional>
Zoom to the closest integer zoom level after the wheel/trackpad or pinch gesture ends. Default is
false
.doubleClickZoom
boolean | undefined <optional>
Whether double click zoom is desired. Default is
true
.keyboard
boolean | undefined <optional>
Whether keyboard interaction is desired. Default is
true
.mouseWheelZoom
boolean | undefined <optional>
Whether mousewheel zoom is desired. Default is
true
.shiftDragZoom
boolean | undefined <optional>
Whether Shift-drag zoom is desired. Default is
true
.dragPan
boolean | undefined <optional>
Whether drag pan is desired. Default is
true
.pinchRotate
boolean | undefined <optional>
Whether pinch rotate is desired. Default is
true
.pinchZoom
boolean | undefined <optional>
Whether pinch zoom is desired. Default is
true
.zoomDelta
number | undefined <optional>
Zoom delta.
zoomDuration
number | undefined <optional>
Zoom duration.
-
olx.interaction.DoubleClickZoomOptions{Object}
-
Properties:
Name Type Argument Description duration
number | undefined <optional>
Animation duration in milliseconds. Default is
250
.delta
number | undefined <optional>
The zoom delta applied on each double click, default is
1
. -
olx.interaction.DragAndDropOptions{Object}
-
Properties:
Name Type Argument Description formatConstructors
Array.<function(new:ol.format.Feature)> | undefined <optional>
Format constructors.
source
ol.source.Vector | undefined <optional>
Optional vector source where features will be added. If a source is provided all existing features will be removed and new features will be added when they are dropped on the target. If you want to add features to a vector source without removing the existing features (append only), instead of providing the source option listen for the "addfeatures" event.
projection
ol.ProjectionLike Target projection. By default, the map's view's projection is used.
target
Element | undefined <optional>
The element that is used as the drop target, default is the viewport element.
-
olx.interaction.DragBoxOptions{Object}
-
Properties:
Name Type Argument Description className
string | undefined <optional>
CSS class name for styling the box. The default is
ol-dragbox
.condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.always
.minArea
number | undefined <optional>
The minimum area of the box in pixel, this value is used by the default
boxEndCondition
function. Default is64
.boxEndCondition
ol.DragBoxEndConditionType | undefined <optional>
A function that takes a
ol.MapBrowserEvent
and twool.Pixel
s to indicate whether aboxend
event should be fired. Default istrue
if the area of the box is bigger than theminArea
option. -
olx.interaction.DragPanOptions{Object}
-
Properties:
Name Type Argument Description condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.noModifierKeys
.kinetic
ol.Kinetic | undefined <optional>
Kinetic inertia to apply to the pan.
-
olx.interaction.DragRotateAndZoomOptions{Object}
-
Properties:
Name Type Argument Description condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.shiftKeyOnly
.duration
number | undefined <optional>
Animation duration in milliseconds. Default is
400
. -
olx.interaction.DragRotateOptions{Object}
-
Properties:
Name Type Argument Description condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.altShiftKeysOnly
.duration
number | undefined <optional>
Animation duration in milliseconds. Default is
250
. -
olx.interaction.DragZoomOptions{Object}
-
Properties:
Name Type Argument Description className
string | undefined <optional>
CSS class name for styling the box. The default is
ol-dragzoom
.condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.shiftKeyOnly
.duration
number | undefined <optional>
Animation duration in milliseconds. Default is
200
.out
boolean | undefined <optional>
Use interaction for zooming out. Default is
false
. -
olx.interaction.DrawOptions{Object}
-
Properties:
Name Type Argument Description clickTolerance
number | undefined <optional>
The maximum distance in pixels between "down" and "up" for a "up" event to be considered a "click" event and actually add a point/vertex to the geometry being drawn. Default is 6 pixels. That value was chosen for the draw interaction to behave correctly on mouse as well as on touch devices.
features
ol.Collection.<ol.Feature> | undefined <optional>
Destination collection for the drawn features.
source
ol.source.Vector | undefined <optional>
Destination source for the drawn features.
snapTolerance
number | undefined <optional>
Pixel distance for snapping to the drawing finish. Default is
12
.type
ol.geom.GeometryType | string Drawing type ('Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon' or 'Circle'). Required.
stopClick
boolean | undefined <optional>
Stop click, singleclick, and doubleclick events from firing during drawing. Default is
false
.maxPoints
number | undefined <optional>
The number of points that can be drawn before a polygon ring or line string is finished. The default is no restriction.
minPoints
number | undefined <optional>
The number of points that must be drawn before a polygon ring or line string can be finished. Default is
3
for polygon rings and2
for line strings.finishCondition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether the drawing can be finished.style
ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined <optional>
Style for sketch features.
geometryFunction
ol.DrawGeometryFunctionType | undefined <optional>
Function that is called when a geometry's coordinates are updated.
geometryName
string | undefined <optional>
Geometry name to use for features created by the draw interaction.
condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. By defaultol.events.condition.noModifierKeys
, i.e. a click, adds a vertex or deactivates freehand drawing.freehand
boolean | undefined <optional>
Operate in freehand mode for lines, polygons, and circles. This makes the interaction always operate in freehand mode and takes precedence over any
freehandCondition
option.freehandCondition
ol.EventsConditionType | undefined <optional>
Condition that activates freehand drawing for lines and polygons. This function takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. The default isol.events.condition.shiftKeyOnly
, meaning that the Shift key activates freehand drawing.wrapX
boolean | undefined <optional>
Wrap the world horizontally on the sketch overlay. Default is
false
. -
olx.interaction.ExtentOptions{Object}
-
Properties:
Name Type Argument Description extent
ol.Extent | undefined <optional>
Initial extent. Defaults to no initial extent
boxStyle
ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined <optional>
Style for the drawn extent box. Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POLYGON]
pixelTolerance
number | undefined <optional>
Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is
10
.pointerStyle
ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined <optional>
Style for the cursor used to draw the extent. Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POINT]
wrapX
boolean | undefined <optional>
Wrap the drawn extent across multiple maps in the X direction? Only affects visuals, not functionality. Defaults to false.
-
olx.interaction.InteractionOptions{Object}
-
Object literal with config options for interactions.
Properties:
Name Type Description handleEvent
function Method called by the map to notify the interaction that a browser event was dispatched to the map. If the function returns a falsy value, propagation of the event to other interactions in the map's interactions chain will be prevented (this includes functions with no explicit return). See https://developer.mozilla.org/en-US/docs/Glossary/Falsy Required.
-
olx.interaction.KeyboardPanOptions{Object}
-
Properties:
Name Type Argument Description condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.noModifierKeys
andol.events.condition.targetNotEditable
.duration
number | undefined <optional>
Animation duration in milliseconds. Default is
100
.pixelDelta
number | undefined <optional>
Pixel The amount to pan on each key press. Default is
128
pixels. -
olx.interaction.KeyboardZoomOptions{Object}
-
Properties:
Name Type Argument Description duration
number | undefined <optional>
Animation duration in milliseconds. Default is
100
.condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. Default isol.events.condition.targetNotEditable
.delta
number | undefined <optional>
The amount to zoom on each key press. Default is
1
. -
olx.interaction.ModifyOptions{Object}
-
Properties:
Name Type Argument Description condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event will be considered to add or move a vertex to the sketch. Default isol.events.condition.primaryAction
.deleteCondition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. By default,ol.events.condition.singleClick
withol.events.condition.altKeyOnly
results in a vertex deletion.insertVertexCondition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether a new vertex can be added to the sketch features. Default isol.events.condition.always
pixelTolerance
number | undefined <optional>
Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is
10
.style
ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined <optional>
Style used for the features being modified. By default the default edit style is used (see
ol.style
).source
ol.source.Vector | undefined <optional>
The vector source with features to modify. If a vector source is not provided, a feature collection must be provided with the features option.
features
ol.Collection.<ol.Feature> | undefined <optional>
The features the interaction works on. If a feature collection is not provided, a vector source must be provided with the source option.
wrapX
boolean | undefined <optional>
Wrap the world horizontally on the sketch overlay. Default is
false
. -
olx.interaction.MouseWheelZoomOptions{Object}
-
Properties:
Name Type Argument Description duration
number | undefined <optional>
Animation duration in milliseconds. Default is
250
.timeout
number | undefined <optional>
Mouse wheel timeout duration in milliseconds. Default is
80
.constrainResolution
boolean | undefined <optional>
When using a trackpad or magic mouse, zoom to the closest integer zoom level after the scroll gesture ends. Default is
false
.useAnchor
boolean | undefined <optional>
Enable zooming using the mouse's location as the anchor. Default is
true
. When set to false, zooming in and out will zoom to the center of the screen instead of zooming on the mouse's location. -
olx.interaction.PinchRotateOptions{Object}
-
Properties:
Name Type Argument Description duration
number | undefined <optional>
The duration of the animation in milliseconds. Default is
250
.threshold
number | undefined <optional>
Minimal angle in radians to start a rotation. Default is
0.3
. -
olx.interaction.PinchZoomOptions{Object}
-
Properties:
Name Type Argument Description duration
number | undefined <optional>
Animation duration in milliseconds. Default is
400
.constrainResolution
boolean | undefined <optional>
Zoom to the closest integer zoom level after the pinch gesture ends. Default is
false
. -
olx.interaction.PointerOptions{Object}
-
Properties:
Name Type Argument Description handleDownEvent
function | undefined <optional>
Function handling "down" events. If the function returns
true
then a drag sequence is started.handleDragEvent
function | undefined <optional>
Function handling "drag" events. This function is called on "move" events during a drag sequence.
handleEvent
function | undefined <optional>
Method called by the map to notify the interaction that a browser event was dispatched to the map. The function may return
false
to prevent the propagation of the event to other interactions in the map's interactions chain.handleMoveEvent
function | undefined <optional>
Function handling "move" events. This function is called on "move" events, also during a drag sequence (so during a drag sequence both the
handleDragEvent
function and this function are called).handleUpEvent
function | undefined <optional>
Function handling "up" events. If the function returns
false
then the current drag sequence is stopped. -
olx.interaction.SelectOptions{Object}
-
Properties:
Name Type Argument Description addCondition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. By default, this isol.events.condition.never
. Use this if you want to use different events for add and remove instead oftoggle
.condition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. This is the event for the selected features as a whole. By default, this isol.events.condition.singleClick
. Clicking on a feature selects that feature and removes any that were in the selection. Clicking outside any feature removes all from the selection. Seetoggle
,add
,remove
options for adding/removing extra features to/ from the selection.layers
undefined | Array.<ol.layer.Layer> | function <optional>
A list of layers from which features should be selected. Alternatively, a filter function can be provided. The function will be called for each layer in the map and should return
true
for layers that you want to be selectable. If the option is absent, all visible layers will be considered selectable.style
ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined <optional>
Style for the selected features. By default the default edit style is used (see
ol.style
).removeCondition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. By default, this isol.events.condition.never
. Use this if you want to use different events for add and remove instead oftoggle
.toggleCondition
ol.EventsConditionType | undefined <optional>
A function that takes an
ol.MapBrowserEvent
and returns a boolean to indicate whether that event should be handled. This is in addition to thecondition
event. By default,ol.events.condition.shiftKeyOnly
, i.e. pressingshift
as well as thecondition
event, adds that feature to the current selection if it is not currently selected, and removes it if it is. Seeadd
andremove
if you want to use different events instead of a toggle.multi
boolean | undefined <optional>
A boolean that determines if the default behaviour should select only single features or all (overlapping) features at the clicked map position. Default is false i.e single select
features
ol.Collection.<ol.Feature> | undefined <optional>
Collection where the interaction will place selected features. Optional. If not set the interaction will create a collection. In any case the collection used by the interaction is returned by
ol.interaction.Select#getFeatures
.filter
ol.SelectFilterFunction | undefined <optional>
A function that takes an
ol.Feature
and anol.layer.Layer
and returnstrue
if the feature may be selected orfalse
otherwise.wrapX
boolean | undefined <optional>
Wrap the world horizontally on the selection overlay. Default is
true
.hitTolerance
number | undefined <optional>
Hit-detection tolerance. 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.interaction.SnapOptions{Object}
-
Options for snap
Properties:
Name Type Argument Description features
ol.Collection.<ol.Feature> | undefined <optional>
Snap to these features. Either this option or source should be provided.
edge
boolean | undefined <optional>
Snap to edges. Default is
true
.vertex
boolean | undefined <optional>
Snap to vertices. Default is
true
.pixelTolerance
number | undefined <optional>
Pixel tolerance for considering the pointer close enough to a segment or vertex for snapping. Default is
10
pixels.source
ol.source.Vector | undefined <optional>
Snap to features from this source. Either this option or features should be provided
-
olx.interaction.TranslateOptions{Object}
-
Properties:
Name Type Argument Description features
ol.Collection.<ol.Feature> | undefined <optional>
Only features contained in this collection will be able to be translated. If not specified, all features on the map will be able to be translated.
layers
undefined | Array.<ol.layer.Layer> | function <optional>
A list of layers from which features should be translated. Alternatively, a filter function can be provided. The function will be called for each layer in the map and should return
true
for layers that you want to be translatable. If the option is absent, all visible layers will be considered translatable.hitTolerance
number | undefined <optional>
Hit-detection tolerance. 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
.