Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
Is this question any help? gis.stackexchange.com/questions/15955/… –  Casey Nov 10 '11 at 15:22

3 Answers 3

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;
};
map.addControl(ovControl);

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;
};
map.addControl(ovControl);
share|improve this answer

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 :)

share|improve this answer

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", 
    "http://vmap0.tiles.osgeo.org/wms/vmap0",
    {layers: 'basic'}
);
map.addLayer(ol);
map.setCenter(new OpenLayers.LonLat(0, 0), 2);
ov = new OpenLayers.Control.OverviewMap({maximized: true});
map.addControl(ov);
ov.maxRatio = ov.ovmap.getResolution()/map.getResolutionForZoom(map.numZoomLevels);
ov.minRatio = ov.ovmap.getResolution()/map.getResolurionForZoom(0);

Link to jsfiddle.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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