I'm new to GIS and OpenLayers, and I can't understand why is it that OpenLayers 2 force the base layer to retile when zoom is changed.

I'm talking about moveTo function in Grid.js, where following code exists:

// if grid is empty or zoom has changed, we *must* re-tile
var forceReTile = !this.grid.length || zoomChanged;

It is some piece of code which was added 9 years ago in version 2.5 and stayed there until now (2.13.1), so I don't think it would be a bug, but I just don't understand why it is needed. I mean, if zoom changed and I'm going to load new tiles, why to request for current tiles in the first place, if I'm going to change them anyway?

Under which conditions (if any) would it be safe to change the previous code to:

// only if grid is empty, we *must* re-tile
var forceReTile = !this.grid.length;

in order to reduce requests in my GIS?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.