I want to display the layer using WMS and meanwhile I want to limit the number of tiles with their respecive BBox when map is loaded. At the backend I am using geoserver.

I can limit the number of features to load for WFS using "Maximum number of features" option in WFS setting in geoserver. But I am somehow lost to find the way of limiting number of tiles in WMS. If I do like:

var bound = new OpenLayers.Bounds(6.9228, 50.9251, 6.9911, 50.9574);

and if i go and play around with different lat-lon bbox i can see in tomcat log file that, get request for tiles with respective BBOX are varying depending upon how deep i am looking for.

Is there any config setting in geoserver or openlayers api to control the tiles? Thanks


I think you are missing some thing here :-) This is not how WMS servers work, You are also conflating tiles and features. With tiles. If you are using tiles then the hope is that a tile will be drawn once and cached for subsequent viewings. The cache can be at the server (where the cost of drawing a tile can be shared between all users) or in the browser (where it will only benefit the user of that machine). So it doesn't really matter how many features are drawn on a tile as the next time you view it there will be no draw at all.

If your WMS (or initial tile draw) is too slow because of the number of features being drawn then the best plan is to work out why that is. Adding an index to your data will be the first thing to try, then look at the type of data store you are using (try PostGIS instead of shapefiles etc). Finally if things are still too slow look at scale dependent rendering using SLD (http://geo.ifip.tuwien.ac.at/imak/2009/stack_workshop/doc/sld_basic/scale.html) to restrict the drawing of features to the most important ones when the user is zoomed out.

  • Thanks iant, for a nice explantion and correcting some of my conventions towards WMS. – panalbish Nov 24 '11 at 9:08
  • okay I am piggy backing on the question, but I am in a similar situation. Is there a way to actually tell openLayers not to request tiles out of particular bounds? i want the rest of map and other layers still accessible, so maxExtent on map is not an option for me. I just want to restrict one WMS layer to perticular bounds, if view port is inside the bounds and user zooms in.. fine! but if viewport is outside, the WMS should only fill the bounded area with tiles from that layer..does that make sense or is that even possible? – Shaunak Oct 12 '12 at 22:27
  • Okay I have created a question for this here: gis.stackexchange.com/questions/35669/… – Shaunak Oct 12 '12 at 22:35

As far as I know, the only way of limiting the number of loaded tiles is by setting the property buffer that can be found in the class OpenLayers.Layer.Grid (the class OpenLayers.Layer.WMS inherits from OpenLayers.Layer.Grid).

  • Thanks for the answer. I think using buffer option, map will draw tiles outside viewing area. But , in my case I need to restrict loading all the features even they fall in defined BBOX. Since I want to test how the performance is when (for example 100 features are loaded, similary 500, 1000, 10000..). Is it possible something like this, or I am missing something here. – panalbish Nov 23 '11 at 20:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.