Class: Select

ol.interaction.Select

Handles selection of vector data.

new ol.interaction.Select(opt_options) experimental

Name Type Description
options optional

Options.

Name Type Description
addCondition ol.events.ConditionType | undefined optional

A conditional modifier (e.g. alt key) that determines if the feature is added to the current selection. By default, this is never. Note that the default toggle condition allows features to be added.

condition ol.events.ConditionType | undefined optional

A conditional modifier (e.g. shift key) that determines if the interaction is active (i.e. selection occurs) or not. By default, a click with no modifier keys toggles the selection.

layers Array.<ol.layer.Layer> | function

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.feature.StyleFunction | undefined optional

FeatureOverlay style.

removeCondition ol.events.ConditionType | undefined optional

A conditional modifier (e.g. alt key) that determines if the feature is removed from the current selection. By default, this is never.

toggleCondition ol.events.ConditionType | undefined optional

A conditional modifier (e.g. shift key) that determines if the selection is toggled in the current selection. By default, a shift-click toggles the feature in the current selection.

Extends

Methods

dispatchChangeEvent() inherited experimental

Dispatches a change event.

Fires:
  • change experimental
Returns:
Features collection.

on(type, listener, opt_this){goog.events.Key} inherited experimental

Listen for a certain type of event.

Name Type Description
type string | Array.<string>

The event type or array of event types.

listener function

The listener function.

this Object optional

The object to use as this in listener.

Returns:
Unique key for the listener.

once(type, listener, opt_this){goog.events.Key} inherited experimental

Listen once for a certain type of event.

Name Type Description
type string | Array.<string>

The event type or array of event types.

listener function

The listener function.

this Object optional

The object to use as this in listener.

Returns:
Unique key for the listener.

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Name Type Description
map ol.Map

Map.

un(type, listener, opt_this) inherited experimental

Unlisten for a certain type of event.

Name Type Description
type string | Array.<string>

The event type or array of event types.

listener function

The listener function.

this Object optional

The object to use as this in listener.

unByKey(key) inherited experimental

Removes an event listener using the key returned by on() or once().

Name Type Description
key goog.events.Key

Key.