How to get Zoom-in, Zoom-out for previous or next in OpenLayers 3. There are controls for Zoom in or Zoom out for levels and area wise. They are as follows:

    Area zoom:
    var dragzoomin = new ol.interaction.DragZoom({
                condition: ol.events.condition.always

Zoom in for levels

    var view = map.getView();
            view.setZoom(view.getZoom() + 1);

We can get zoom out if it is level wise. But if it is area wise how to get zoom out and how to store these zoom in and zoom out events for entire session.

1 Answer 1


You can easily hook it up to the browser's history's buttons. See: http://openlayers.org/en/latest/examples/permalink.html for an example of how to do this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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