[OpenLayers-Users] Too many tiles being loaded

Dylan Parry me at dylanparry.com
Mon Mar 15 08:49:14 EDT 2010


Hi,

I’ve got a layer on one of my maps and it seems to be loading many more 
tiles than are actually necessary for the viewport. Looking at the 
screen, it would probably suffice to load in maybe 10 tiles at most, but 
it seems to be loading upwards of 60 each time, which means that zooming 
in takes ages to load any tiles that are actually in the viewport as 
it’s too busy loading in ones outside it! The code I’ve got for the 
layer is:

layer = new OpenLayers.Layer.TMS("Layer", "…", { 'type':'png', 
'getURL':getMapUrl }, { 'buffer':0 });

Now I thought that adding in the buffer bit would stop it loading tiles 
from outside the viewport, but it’s had no effect. The map is 
initialised as:

map = new OpenLayers.Map(
     'holder', {
         maxExtent: new OpenLayers.Bounds(413273,378720,445078,400749),
         maxResolution: 'auto',
         units:'m',
         projection: 'EPSG:27700',
         controls: [
             new OpenLayers.Control.Navigation(),
             new OpenLayers.Control.PanZoomBar(),
             new OpenLayers.Control.ScaleLine(),
             new OpenLayers.Control.EditingToolbar(vlayer)
         ],
         numZoomLevels: 10
     }
);

Other than some code to change the default double-click behaviour, 
that’s about it for the map. Any ideas what I might be doing wrong?

-- 
Dylan Parry



More information about the Users mailing list