new Map
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
olx.MapOptions | Map options. Properties
|
- Source:
- map.js, line 170
Fires:
- ol.MapBrowserEvent ol.event:MapBrowserEvent
- ol.MapEvent ol.event:MapEvent
- ol.render.Event ol.render.event:Event
- ol.ObjectEvent ol.event:ObjectEvent
Extends
Observable Properties
| Name | Type | Settable | ol.ObjectEvent type | Description |
|---|---|---|---|---|
layergroup |
ol.layer.Group | yes | change:layergroup |
a layer group containing the layers in this map. |
size |
ol.Size | yes | change:size |
the size in pixels of the map in the DOM |
target |
string | Element | yes | change:target |
the Element or id of the Element that the map is rendered in. |
view |
ol.IView | yes | change:view |
the view that controls this map |
Methods
-
addControl
Stability: experimental -
Add the given control to the map.
Parameters:
Name Type Description controlol.control.Control Control.
- Source:
- map.js, line 471
-
addInteraction
Stability: experimental -
Add the given interaction to the map.
Parameters:
Name Type Description interactionol.interaction.Interaction Interaction to add.
- Source:
- map.js, line 483
-
addLayer
Stability: experimental -
Adds the given layer to the top of this map.
Parameters:
Name Type Description layerol.layer.Base Layer.
- Source:
- map.js, line 495
-
addOverlay
Stability: experimental -
Add the given overlay to the map.
Parameters:
Name Type Description overlayol.Overlay Overlay.
- Source:
- map.js, line 507
-
beforeRender
Stability: experimental -
Add functions to be called before rendering. This can be used for attaching animations before updating the map's view. The ol.animation namespace provides several static methods for creating prerender functions.
Parameters:
Name Type Description var_argsol.PreRenderFunction Any number of pre-render functions.
- Source:
- map.js, line 521
-
bindTo
Stability: experimental -
The bindTo method allows you to set up a two-way binding between a
sourceandtargetobject. The method returns an ol.ObjectAccessor with a transform method that lets you transform values on the way from the source to the target and on the way back.For example, if you had two map views (sourceView and targetView) and you wanted the target view to have double the resolution of the source view, you could transform the resolution on the way to and from the target with the following:
sourceView.bindTo('resolution', targetView) .transform( function(sourceResolution) { // from sourceView.resolution to targetView.resolution return 2 * sourceResolution; }, function(targetResolution) { // from targetView.resolution to sourceView.resolution return targetResolution / 2; } );Parameters:
Name Type Argument Description keystring Key name.
targetol.Object Target.
targetKeystring <optional>
Target key.
- Inherited From:
- Source:
- object.js, line 247
Returns:
- Type
- ol.ObjectAccessor
-
dispatchChangeEvent
Stability: experimental -
Dispatches a
changeevent. Register a listener for this event to get notified of changes.- Inherited From:
- Source:
- observable.js, line 39
Fires:
- event:change
-
forEachFeatureAtPixel
Stability: experimental -
Parameters:
Name Type Argument Description pixelol.Pixel Pixel.
callbackfunction Feature callback.
thisS <optional>
Value to use as
thiswhen executingcallback.layerFilterfunction Layer filter function, only layers which are visible and for which this function returns
truewill be tested for features. By default, all visible layers will be tested.this2U <optional>
Value to use as
thiswhen executinglayerFilter.- Source:
- map.js, line 560
Returns:
Callback result.
- Type
- T | undefined
-
get
Stability: experimental -
Gets a value.
Parameters:
Name Type Description keystring Key name.
- Inherited From:
- Source:
- object.js, line 304
Returns:
Value.
- Type
- *
-
getControls
Stability: experimental -
- Source:
- map.js, line 650
Returns:
Controls.
- Type
- ol.Collection
-
getCoordinateFromPixel
Stability: experimental -
Parameters:
Name Type Description pixelol.Pixel Pixel.
- Source:
- map.js, line 635
Returns:
Coordinate.
- Type
- ol.Coordinate
-
getEventCoordinate
Stability: experimental -
Returns the geographical coordinate for a browser event.
Parameters:
Name Type Description eventEvent Event.
- Source:
- map.js, line 582
Returns:
Coordinate.
- Type
- ol.Coordinate
-
getEventPixel
Stability: experimental -
Returns the map pixel position for a browser event.
Parameters:
Name Type Description eventEvent Event.
- Source:
- map.js, line 593
Returns:
Pixel.
- Type
- ol.Pixel
-
getInteractions
Stability: experimental -
Gets the collection of ol.interaction.Interaction instances associated with this map. Modifying this collection changes the interactions associated with the map.
Interactions are used for e.g. pan, zoom and rotate.
- Source:
- map.js, line 674
Returns:
Interactions.
- Type
- ol.Collection
-
getKeys
Stability: experimental -
Get a list of object property names.
- Inherited From:
- Source:
- object.js, line 332
Returns:
List of property names.
- Type
- Array.<string>
-
getLayerGroup
Stability: experimental -
Get the layergroup associated with this map.
- Source:
- map.js, line 684
Returns:
LayerGroup.
- Type
- ol.layer.Group
-
getLayers
Stability: experimental -
Get the collection of layers associated with this map.
- Source:
- map.js, line 699
Returns:
Layers.
- Type
- ol.Collection | undefined
-
getOverlays
Stability: experimental -
- Source:
- map.js, line 659
Returns:
Overlays.
- Type
- ol.Collection
-
getPixelFromCoordinate
Stability: experimental -
Parameters:
Name Type Description coordinateol.Coordinate Coordinate.
- Source:
- map.js, line 714
Returns:
Pixel.
- Type
- ol.Pixel
-
getProperties
Stability: experimental -
Get an object of all property names and values.
- Inherited From:
- Source:
- object.js, line 364
Returns:
Object.
- Type
- Object.<string, *>
-
getSize
Stability: experimental -
Get the size of this map.
- Source:
- map.js, line 730
Returns:
Size.
- Type
- ol.Size | undefined
-
getTarget
Stability: experimental -
Get the target in which this map is rendered. Note that this returns what is entered as an option or in setTarget: if that was an element, it returns an element; if a string, it returns that.
- Source:
- map.js, line 620
Returns:
Target.
- Type
- Element | string | undefined
-
getView
Stability: experimental -
Get the view associated with this map. This can be a 2D or 3D view. A 2D view manages properties such as center and resolution.
- Source:
- map.js, line 745
Returns:
View.
- Type
- ol.View | undefined
-
getViewport
Stability: experimental -
- Source:
- map.js, line 758
Returns:
Viewport.
- Type
- Element
-
notify
Stability: experimental -
Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.
Parameters:
Name Type Description keystring Key name.
- Inherited From:
- Source:
- object.js, line 384
-
on
Stability: experimental -
Listen for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
The object to use as
thisinlistener.- Inherited From:
- Source:
- observable.js, line 61
Returns:
Unique key for the listener.
- Type
- goog.events.Key
-
once
Stability: experimental -
Listen once for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
The object to use as
thisinlistener.- Inherited From:
- Source:
- observable.js, line 74
Returns:
Unique key for the listener.
- Type
- goog.events.Key
-
removeControl
Stability: experimental -
Remove the given control from the map.
Parameters:
Name Type Description controlol.control.Control Control.
- Source:
- map.js, line 1091
Returns:
The removed control of undefined if the control was not found.
- Type
- ol.control.Control | undefined
-
removeInteraction
Stability: experimental -
Remove the given interaction from the map.
Parameters:
Name Type Description interactionol.interaction.Interaction Interaction to remove.
- Source:
- map.js, line 1108
Returns:
The removed interaction (or undefined if the interaction was not found).
- Type
- ol.interaction.Interaction | undefined
-
removeLayer
Stability: experimental -
Removes the given layer from the map.
Parameters:
Name Type Description layerol.layer.Base Layer.
- Source:
- map.js, line 1126
Returns:
The removed layer or undefined if the layer was not found.
- Type
- ol.layer.Base | undefined
-
removeOverlay
Stability: experimental -
Remove the given overlay from the map.
Parameters:
Name Type Description overlayol.Overlay Overlay.
- Source:
- map.js, line 1140
Returns:
The removed overlay of undefined if the overlay was not found.
- Type
- ol.Overlay | undefined
-
render
Stability: experimental -
Request that renderFrame_ be called some time in the future.
- Source:
- map.js, line 1077
-
renderSync
Stability: experimental -
Render.
- Source:
- map.js, line 1068
-
set
Stability: experimental -
Sets a value.
Parameters:
Name Type Description keystring Key name.
value* Value.
- Inherited From:
- Source:
- object.js, line 415
-
setLayerGroup
Stability: experimental -
Sets the layergroup of this map.
Parameters:
Name Type Description layerGroupol.layer.Group Layergroup.
- Source:
- map.js, line 1262
-
setSize
Stability: experimental -
Set the size of this map.
Parameters:
Name Type Description sizeol.Size | undefined Size.
- Source:
- map.js, line 1276
-
setTarget
Stability: experimental -
Set the target element to render this map into.
Parameters:
Name Type Description targetElement | string | undefined Target.
- Source:
- map.js, line 1290
-
setValues
Stability: experimental -
Sets a collection of key-value pairs.
Parameters:
Name Type Description valuesObject.<string, *> Values.
- Inherited From:
- Source:
- object.js, line 444
-
setView
Stability: experimental -
Set the view for this map. Currently ol.View2D is implememnted.
Parameters:
Name Type Description viewol.IView View.
- Source:
- map.js, line 1304
-
un
Stability: experimental -
Unlisten for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
The object to use as
thisinlistener.- Inherited From:
- Source:
- observable.js, line 86
-
unbind
Stability: experimental -
Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.
Parameters:
Name Type Description keystring Key name.
- Inherited From:
- Source:
- object.js, line 458
-
unbindAll
Stability: experimental -
Removes all bindings.
- Inherited From:
- Source:
- object.js, line 482
-
unByKey
Stability: experimental -
Removes an event listener using the key returned by
on()oronce().Parameters:
Name Type Description keygoog.events.Key Key.
- Inherited From:
- Source:
- observable.js, line 96
-
updateSize
Stability: experimental -
Force a recalculation of the map viewport size. This should be called when third-party code changes the size of the map viewport.
- Source:
- map.js, line 1328
OpenLayers 3