experimental new ol.Map(options)
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Map options.
|
|||||||||||||||||||||||||||||||||||||
Fires:
-
experimental
beforepropertychange(ol.ObjectEvent) - Triggered before a property is changed. -
change -
change:layerGroup(ol.ObjectEvent) -
change:size(ol.ObjectEvent) -
change:target(ol.ObjectEvent) -
change:view(ol.ObjectEvent) -
experimental
click(ol.MapBrowserEvent) - A click with no dragging. A double click will fire two of this. -
experimental
dblclick(ol.MapBrowserEvent) - A true double click, with no dragging. -
experimental
moveend(ol.MapEvent) - Triggered after the map is moved. -
experimental
pointerdrag(ol.MapBrowserEvent) - Triggered when a pointer is dragged. -
experimental
pointermove(ol.MapBrowserEvent) - Triggered when a pointer is moved. -
experimental
postcompose(ol.render.Event) -
experimental
postrender(ol.MapEvent) - Triggered after a map frame is rendered. -
experimental
precompose(ol.render.Event) -
experimental
propertychange(ol.ObjectEvent) - Triggered when a property is changed. -
experimental
render(ol.render.Event) -
experimental
singleclick(ol.MapBrowserEvent) - A true single click with no dragging and no double click. Note that this event is delayed by 250 ms to ensure that it is not a double click.
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 | undefined | yes | change:size |
The size in pixels of the map in the DOM. |
target |
Element | string | undefined | yes | change:target |
The Element or id of the Element that the map is rendered in. |
view |
ol.IView | undefined | yes | change:view |
The view that controls this map. |
Methods
-
experimental addControl(control)
-
Add the given control to the map.
Name Type Description controlol.control.Control Control.
-
experimental addInteraction(interaction)
-
Add the given interaction to the map.
Name Type Description interactionol.interaction.Interaction Interaction to add.
-
experimental addLayer(layer)
-
Adds the given layer to the top of this map.
Name Type Description layerol.layer.Base Layer.
-
experimental addOverlay(overlay)
-
Add the given overlay to the map.
Name Type Description overlayol.Overlay Overlay.
-
experimental beforeRender(var_args)
-
Add functions to be called before rendering. This can be used for attaching animations before updating the map's view. The
ol.animationnamespace provides several static methods for creating prerender functions.Name Type Description var_argsol.PreRenderFunction Any number of pre-render functions.
-
experimental inherited bindTo(key, target, opt_targetKey){ol.ObjectAccessor}
-
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; } );Name Type Argument Description keystring Key name.
targetol.Object Target.
targetKeystring <optional>
optional Target key.
-
experimental inherited dispatchChangeEvent()
-
Dispatches a
changeevent. Register a listener for this event to get notified of changes.Fires:
-
change
-
-
experimental forEachFeatureAtPixel(pixel, callback, opt_this, opt_layerFilter, opt_this2){T|undefined}
-
Name Type Argument Description pixelol.Pixel Pixel.
callbackfunction Feature callback.
thisS <optional>
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>
optional Value to use as
thiswhen executinglayerFilter.Returns:
result.
-
experimental inherited get(key){*}
-
Gets a value.
Name Type Description keystring Key name.
-
experimental getControls(){ol.Collection}
-
-
experimental getCoordinateFromPixel(pixel){ol.Coordinate}
-
Name Type Description pixelol.Pixel Pixel.
-
experimental getEventCoordinate(event){ol.Coordinate}
-
Returns the geographical coordinate for a browser event.
Name Type Description eventEvent Event.
-
experimental getEventPixel(event){ol.Pixel}
-
Returns the map pixel position for a browser event.
Name Type Description eventEvent Event.
-
experimental getInteractions(){ol.Collection}
-
Gets the collection of
ol.interaction.Interactioninstances associated with this map. Modifying this collection changes the interactions associated with the map.Interactions are used for e.g. pan, zoom and rotate.
Returns:
ol.interaction.Interaction Interactions}.
-
experimental inherited getKeys(){Array.<string>}
-
Get a list of object property names.
Returns:
of property names.
-
experimental getLayerGroup(){ol.layer.Group}
-
Get the layergroup associated with this map.
Returns:
layer group containing the layers in this map.
-
experimental getLayers(){ol.Collection|undefined}
-
Get the collection of layers associated with this map.
-
experimental getOverlays(){ol.Collection}
-
-
experimental getPixelFromCoordinate(coordinate){ol.Pixel}
-
Name Type Description coordinateol.Coordinate Coordinate.
-
experimental inherited getProperties(){Object.<string, *>}
-
Get an object of all property names and values.
-
experimental getSize(){ol.Size|undefined}
-
Get the size of this map.
Returns:
size in pixels of the map in the DOM.
-
experimental getTarget(){Element|string|undefined}
-
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.
Returns:
Element or id of the Element that the map is rendered in.
-
experimental getView(){ol.IView|undefined}
-
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.
Returns:
view that controls this map.
-
experimental getViewport(){Element}
-
-
experimental inherited notify(key)
-
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.
Name Type Description keystring Key name.
-
experimental inherited on(type, listener, opt_this){goog.events.Key}
-
Listen for a certain type of event.
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
optional The object to use as
thisinlistener.Returns:
key for the listener.
-
experimental inherited once(type, listener, opt_this){goog.events.Key}
-
Listen once for a certain type of event.
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
optional The object to use as
thisinlistener.Returns:
key for the listener.
-
experimental removeControl(control){ol.control.Control|undefined}
-
Remove the given control from the map.
Name Type Description controlol.control.Control Control.
Returns:
removed control of undefined if the control was not found.
-
experimental removeInteraction(interaction){ol.interaction.Interaction|undefined}
-
Remove the given interaction from the map.
Name Type Description interactionol.interaction.Interaction Interaction to remove.
Returns:
removed interaction (or undefined if the interaction was not found).
-
experimental removeLayer(layer){ol.layer.Base|undefined}
-
Removes the given layer from the map.
Name Type Description layerol.layer.Base Layer.
Returns:
removed layer or undefined if the layer was not found.
-
experimental removeOverlay(overlay){ol.Overlay|undefined}
-
Remove the given overlay from the map.
Name Type Description overlayol.Overlay Overlay.
Returns:
removed overlay of undefined if the overlay was not found.
-
experimental render()
-
Request that renderFrame_ be called some time in the future.
-
experimental renderSync()
-
Render.
-
experimental inherited set(key, value)
-
Sets a value.
Name Type Description keystring Key name.
value* Value.
-
experimental setLayerGroup(layerGroup)
-
Sets the layergroup of this map.
Name Type Description layerGroupol.layer.Group A layer group containing the layers in this map.
-
experimental setSize(size)
-
Set the size of this map.
Name Type Description sizeol.Size | undefined The size in pixels of the map in the DOM.
-
experimental setTarget(target)
-
Set the target element to render this map into.
Name Type Description targetElement | string | undefined The Element or id of the Element that the map is rendered in.
-
experimental inherited setValues(values)
-
Sets a collection of key-value pairs.
Name Type Description valuesObject.<string, *> Values.
-
experimental setView(view)
-
Set the view for this map.
Name Type Description viewol.IView The view that controls this map.
-
experimental inherited un(type, listener, opt_this)
-
Unlisten for a certain type of event.
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject <optional>
optional The object to use as
thisinlistener. -
experimental inherited unbind(key)
-
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.
Name Type Description keystring Key name.
-
experimental inherited unbindAll()
-
Removes all bindings.
-
experimental inherited unByKey(key)
-
Removes an event listener using the key returned by
on()oronce().Name Type Description keygoog.events.Key Key.
-
experimental updateSize()
-
Force a recalculation of the map viewport size. This should be called when third-party code changes the size of the map viewport.
OpenLayers 3