The OpenLayers overview map control works great when I use standard options. I would like to limit the overview to one resolution, but I can't seem to find the right combination of values for the properties and mapOptions. Is there a way to force the overview map to stay at a single zoom level?

The example code below uses the "numZoomLevels : 1" option, but this has no effect.

function init() {
// start with a browser check. If it's IE6, transparent png's are not supported
var ua = $j.browser;
if(ua.msie && ua.version.slice(0, 1) == "6") {
    var imgtype = 'image/gif';
} else {
    var imgtype = 'image/png';

// Define a projection for the map
var proj = new OpenLayers.Projection("EPSG:4326");

// Define the map options and start with an empty control set
var mapOptions = {
    controls: [],  
    projection : new OpenLayers.Projection("EPSG:900913"),
    displayProjection : proj,
    units : "m",
    numZoomLevels : 20
// Create the map object
var map = new OpenLayers.Map('map', mapOptions);

 // Define the overview map options
var overviewOptions = {
    size : new OpenLayers.Size(300, 200),
    maximized : true,
    minRectSize : 0,
    autoPan : true,
    mapOptions : {
        projection : new OpenLayers.Projection("EPSG:900913"),
        displayProjection : proj,
        units : "m",
        resolutions : [90],
        numZoomLevels : 1  // this has no effect, the ov map still zooms in and out with the map

// Add controls to the map
map.addControl(new OpenLayers.Control.OverviewMap(overviewOptions));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.PanZoomBar({panIcons : false}));
map.addControl(new OpenLayers.Control.ScaleLine());
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({
    element : $('location')

// Add layers
var gmap = new OpenLayers.Layer.Google("Google Streets", {
    numZoomLevels : 20


// Start the map at a particular point
var point = new OpenLayers.LonLat(-118, 34);
point.transform(proj, map.getProjectionObject());
map.setCenter(point, 16);

}; // Ends the init()

2 Answers 2


You have an example (of how to change default options for overview map) online at this URL.

// create an overview map control with non-default options
    var controlOptions = {
        maximized: true,
        mapOptions: OpenLayers.Util.extend(mapOptions, {
            maxResolution: 156543.0339,
            maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
                                 20037508.34, 20037508.34)
        layers: [jplOverview]
    var overview2 = new OpenLayers.Control.OverviewMap(controlOptions);

You may have a look on control documentation page :

  // If you'd like to have an overview map that doesn't zoom in and out at all, give it just one zoom level: 

  var options = {mapOptions: {numZoomLevels: 1}};
  map.addControl(new OpenLayers.Control.OverviewMap(options));

For information, Overview map Options are available on the documentation page.

  • Good call @simo. This doesn't do the trick, though. I edited my question to include a code sample. Maybe someone will see what I have done wrong.
    – katahdin
    Oct 21, 2011 at 16:11

Try commenting out the resolutions attribute in the mapOptions object. I created an example based off your code (with some changes, I had trouble getting the Google layer to work, so I subbed in the http://osgeo.org/ world layer) and when I get rid of the resolutions attribute, the overview map works as intended.

  • Thanks @Casey. This is a big help. From your post and the OpenLayers-dev list I picked up that the overview map's properties are inherited from the base layer. Now is there a way to force the overview map to use a particular resolution (e.g., 4.777314267 from the OSM resolutions array)?
    – katahdin
    Oct 22, 2011 at 2:00
  • It looks like you can use the resolutions setting, but the value that you had in your code (90) broke the overview map in my example. I uncommented the resolutions setting and specified 4.777314267, and now its working. Check out my example page again.
    – Casey
    Oct 22, 2011 at 2:36

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.