2

Is there a way to 'lock' the overview map in OpenLayers 3 using a fixed extent?

The current implementation resizes the little rectangle and the map. So when I zoom in or out in my map, the map in the overview map might change as well.

However, I would like the map in the overview map to use a fixed extent, so that it never moves. So when I zoom or pan the map always stays the same and only the rectangle is adjusted.

The Overview Panel in QGIS provides a good example of what I mean.

In the following screenshots I am moving and zooming in QGIS, but my overview map always stays the same and solely the rectangle is adjusted.

enter image description here

enter image description here

I would like to implement that behavior in OpenLayers 3 or 4.

1 Answer 1

2

Just define a view for your overview map:

var overviewMapControl = new ol.control.OverviewMap({
  view: new ol.View({
    maxZoom: 14,
    minZoom: 14,
    zoom: 14
  })
});

map = new ol.Map({
  controls: ol.control.defaults().extend([
    overviewMapControl
  ]),
  other map options
});

Your Answer

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

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