Issue: I've got openlayers application with some overview map which has just one scale so the size of it doesn't change even though I zoomed my map. Now i would like to make overview map locked - blocked, and in the same time to make possible to move the extent rectangle on the overview map, so it's not always in the center. Summing up I want to switch properties between the extent rectangle on the overview map and overview map.

I will be grateful for your help

  • Is this question any help? gis.stackexchange.com/questions/15955/… – Casey Nov 10 '11 at 15:22
  • Thanks a lot. It works now correctly :) Still when I move a view of the main map on some blank area, the overview map is moved as well (i wanna it locked). But it's now just some small issue, not that important. Thanks again :) – user4824 Nov 17 '11 at 8:45

I'm not sure I understand what you want, but think the following code sample may be helpful:

map = new OpenLayers.Map("mapdiv");
var ol = new OpenLayers.Layer.WMS(
    "OpenLayers WMS", 
    {layers: 'basic'}
map.setCenter(new OpenLayers.LonLat(0, 0), 2);
ov = new OpenLayers.Control.OverviewMap({maximized: true});
ov.maxRatio = ov.ovmap.getResolution()/map.getResolutionForZoom(map.numZoomLevels);
ov.minRatio = ov.ovmap.getResolution()/map.getResolurionForZoom(0);

Link to jsfiddle.


Here you can find an article concerning the OverviewMap Control.

I'll cite the relevant paragraph:

[If] you'd like to change the criteria by which the overview map decides when to update itself, you can override the isSuitableOverview() method. To do this, first construct the control, then modify any properties/methods, then add the control to your map:

var ovControl = new OpenLayers.Control.OverviewMap();
ovControl.isSuitableOverview = function() {
    return false;

This will cause the overview map to update itself with each move of the main map - so the extent rectangle will always stay centered. If the same function always returns true, then the overview map will never zoom or recenter itself.

So, your problem should be solved with the following code:

var ovControl = new OpenLayers.Control.OverviewMap();
ovControl.isSuitableOverview = function() {
    return true;

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.