I have quite a problem, hope you'll be able to help. I've got a very large shp layer that I'm loading via wms to my openlayers project. Due the fact that the layer is very big (2 millions polygons) It causing my geoserver to crash. I have 2 solutions to this situation:

  1. I wrote a js code to load the layer only in certain zoom levels. This solution works but i don't want it to be executed via the js code, but via the sld.
  2. write a MaxScaleDenominator statement. when I try this, I know it executes (I see the polygons only at the selected views), but geoserver still crashes. As I can see it, It still loading all the polygons and just after it filtering it, causing it to crash.

Any idea how can I make the zoom filter without loading all the layer ?


1 Answer 1


If your GeoServer is crashing at loading of the huge shapefile, applying filtering at the SLD level is not going to help. GeoServer will still crash.

This problem calls for a Multi-level solution.

  1. Firstly, Load the Data into a Database. I'll suggest that you set up a PostGIS database, and load your data in it. To improve performance, you should add a Spatial Index
  2. Once you publish the data as a service, you should apply an appropriate symbology by using an Scale Dependent Rendering in SLD. generally speaking I'm quite sure that you don't want the Layer to be rendered in the same way at a Low Scale and High Scale. At the minimum, switching of the Labels and Rule based filtering when zoomed out, will lead to a huge Performance benifit.
  3. If this Data does not change often, you should also look into caching the service. Geoserver not having to query the database for every WMS call will lead to a much better performance.
  • Devdatta - What is the difference between loading the polygons from SHP file and from PostGIS ? geoserver still needs to serve same amount of polygons, no ? Also , What do you mean caching the service ? using the Tile Cache?
    – Alophind
    Jan 15, 2014 at 10:37
  • 1
    The shapefile is an very inefficient format. Just querying it and reading it in memory is a memory intensive task. When you store data in RDBMS, not only is the storage efficient, even querying it is efficient. If you have millions of features in a shapefile, you'll definitely see a befit in performance when you use a RDBMS. And yes, by Caching, I mean creating and using tiles. Jan 15, 2014 at 10:50
  • Devdatta - Do you have time to chat in a room ? This is very interesting and I would like your feedback on some geoserver questions :-)
    – Alophind
    Jan 15, 2014 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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