[OpenLayers-Dev] tiling behaviour

Andreas Hocevar ahocevar at opengeo.org
Mon May 10 06:33:28 EDT 2010

On May 8, 2010, at 13:56 , toni hernández wrote:

> max number of tiles
> Hi list,
> I am using a wms layer on a map. Every time I reload the map, I get a quite incomplete map. That's  because  the wms server doesn't render more than 4 or 5 tiles.

Unlikely. Most browsers do not send out more than 4 or 5 requests simultaneously. And your httpd (not wms) can also have restrictions or bottlenecks causing tiles not to be delivered.

> In fact it renders all the tiles but some of them are just pink images. As it renders every tile I can not detect any error but still my map is incomple.

Two things to check:

* you get pink tiles where the requested tiles are outside the maximum extent of your wms layer.

* make sure that you give tiles that are not delivered correctly another chance, by setting OpenLayers.IMAGE_RELOAD_ATTEMPTS to a higher value, e.g. 5.

> First I tried the singleTile property (with ratio:1) but again if the tile is too big I get the pinky image.

If your WMS is MapServer, then you have to set MAXSIZE to a higher value. It won't serve images with x- or y-size larger than that.

> Then I tried bigger tiles combined with buffer:0 property (so no unnecessary tiles are asked).
> I was expecting this to be the best option but then I realized that openlayers defines (at least by default) more tiles than strictly necessary. Some of the tiles are mostly out of the map.

The grid is determined by your maxExtent and maxResolution, not by the map viewport. This is by design and makes "slippy maps" possible. As you can see when you drag the map, these tiles are not wasted.

> Is there a way to prevent this tiling behavior?

Yes - by carefully setting your maxExtent and resolutions. But I would not recommend putting a lot of effort into it. Investigating why your server cannot deliver the tiles is a better investment. Check the logs of your httpd and wms, and check the headers of the server responses as they arrive at the browser, e.g. by using the Net tab of Firebug in Firefox.


> thanks.
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

More information about the Dev mailing list