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.

I have been testing OpenLayers for a while and I notice that the scrolling on OpenStreetMap layer does not make the map zoom in or out as much as I would like it to be. On most occasions, I am only able to zoom in or out by only one level at a time, regardless of the scroll clicks. However, when the base layer is switched to Google Maps, I am able to zoom in and out more with more scroll clicks. You can see the difference with this example.

At first, I thought this could be due to some inherent problem with OpenStreetMaps, but after testing its own map on the main site, there seem to be no problem with zooming through multiple levels with a mouse scroll. Am I missing something in the OpenLayers control setting to enable such responsive scrolling behaviour?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The documentation doesn't say much about this, but if you examine the script, there is a mousewheel interval option:

/**
 * Property: interval
 * {Integer} In order to increase server performance, an interval (in 
 *     milliseconds) can be set to reduce the number of up/down events 
 *     called. If set, a new up/down event will not be set until the 
 *     interval has passed. 
 *     Defaults to 0, meaning no interval. 
 */
interval: 0,

This value can be changed by setting the following when declaring map controls:

new OpenLayers.Control.Navigation(
 {mouseWheelOptions: {interval: 500}}
);
share|improve this answer

You can try overriding the createMap function and define your own scales. Something like below (just put your own values in the scales):

createMap: function(mapDiv) {
    var controls = [new OpenLayers.Control.Navigation()];
        options = {
            projection: new OpenLayers.Projection("EPSG:2039"),
            displayProjection: new OpenLayers.Projection("EPSG:2039"),
            units: "m",
            maxExtent: new OpenLayers.Bounds(-154106, 360012, 603185, 838233),
            scales: [13000, 7000, 5000, 4500, 3500, 1700, 1000, 500],
            controls: controls
        };           
    }
share|improve this answer
    
I don't think this is a solution to the problem. Skipping zoom levels and making it more responsive are two different issues altogether. –  Question Overflow Nov 12 '12 at 7:09

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.