I cannot find this in the docs anywhere but it should be an easy answer for anyone who knows OpenLayers on the inside. In OpenLayers 4.2, what are the possible key values for listeners: during instantiation of an ol.Map object and what are the possible event values that can be passed to e.g. ol.Map.getView().on(event, function, opt_this) to trigger it?


Perhaps these could be useful.



change (ol.events.Event) - Generic change event. Triggered when the revision counter is increased.

click (ol.MapBrowserEvent) - A click with no dragging. A double click will fire two of this.

dblclick (ol.MapBrowserEvent) - A true double click, with no dragging.

moveend (ol.MapEvent) - Triggered after the map is moved.

movestart (ol.MapEvent) - Triggered when the map starts moving.

pointerdrag (ol.MapBrowserEvent) - Triggered when a pointer is dragged.

pointermove (ol.MapBrowserEvent) - Triggered when a pointer is moved. Note that on touch devices this is triggered when the map is panned, so is not the same as mousemove.

postcompose (ol.render.Event)

postrender (ol.MapEvent) - Triggered after a map frame is rendered.

precompose (ol.render.Event)

propertychange (ol.Object.Event) - Triggered when a property is changed.

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.
|improve this answer|||||
  • This is what I was looking for. I want to mention though that change with out appending :resolution caused my map to have really poor responsiveness. Not sure why. – medley56 Sep 7 '17 at 21:38

Event subtypes are listed on the API page while it is your responsibility to provide the listener methods as explained on the events page.

Applications do not normally create event instances. They register (and unregister) event listener functions, which, when called by the library as the result of an event being dispatched, are passed event instances as their first argument. Listeners can be registered and unregistered on all objects descending from ol.Observable. All event instances have a target property, which corresponds to the object on which the event was dispatched. By default, this within the listener also refers to the target, though this can be configured in the listener registration function. Some classes have their own event type, which return additional properties; see the specific event class page for details.

|improve this answer|||||
  • The links are broken. – Worth Lutz Oct 5 '18 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.