I have to develop a webapp that will have to display a large number of polygons on a webpage, with complex filtering options. The source data never changes (I will simply reload a new version of the DB every few months).

I will probably use OpenLayers on the client-side. I developed a prototype that drawed the feature as vectors in javascript, but I'd like to switch to server-side rendering for better performance. I could probably do my app connecting directly OpenLayers to a few different WMS layers in GeoServer (postgis backend) with CQL filters, but I have the feeling GeoServer is not very flexible when using a combination of complex filters and dynamic styling of my WMS and the solution could become quite complex.

From the developer point of view, a more confortable/flexible approach seems to use GeoDjango and its spatially-enabled data models to generate a dynamic (content and styling) KML file of my data. A (probably naive) elegant solution would be to integrate WMS rendering (and possibly caching) layer between the OpenLayers client and the GeoDjango app that generates KML output.

The workflow would be:

  1. Openlayers sends user query to "intermediate layer"

  2. This layers forward query to the GeoDjango app, get a KML file and render it as WMS and return it to OpenLayers.

(alternatively, OL could also talk directly to GeoDjango it sould use a middleware to postprocess its KML result before returning it).

As my data almost never changes, I could then benefit from a caching tool such as GeoWebCache between OL and the "rendering layer".

I know Google Maps API do server-side rendering of KML files when they are large, but it's a black box tied to their JS library, and I'd really like to do something similar with OL.

I've done a few searches, but was not able to find any tool for the "intermediate layer". WMS servers such as GeoServer/Mapserver can use a KML data source, but it seems limited to a static file somewhere in the filesystem, and not from a dynamic URL.

Does a tool like this exists or is my approach simply wrong ?

  • You say you need dynamic styling. Will your styles be different with every request? A tile cache will be of little help if the styling keeps changing all the time.
    – underdark
    Jun 30, 2011 at 7:52
  • Thanks, you're right about this. However, I hope I will be able to keep a short number a different styles (like density maps with only 5 different base colors for example).
    – niconoe
    Jun 30, 2011 at 8:01

2 Answers 2


Openlayers - GeoWebCache - GeoServer - PostGIS

That's all you need.

FYI: GeoServer is NOT limited to static files. You can point geoserver to a spatial database (postGIS), or a shp file that points to a database, or a bunch of other datasources. And all your data is accessible via URL REST or SOAP via the common standards (WMS, WFS, WCS, etc)

  • I was initially curious of integrating GeoDjango in that data flow because of the very "developper-minded" data manipulation I could get... But your solution is fine, as it is using solid tools, each one to do its specific job. I'll just go a little further into manual SQL and forgot GeoDjango fancy stuff for this project.
    – niconoe
    Jul 4, 2011 at 6:29

First I should tell that I am not experienced with KML and GeoDjango (especially I don't know what are the capabilities of GeoDjango) however I would suggest you to look at SLD specification and how it is used with Openlayers + Geoserver stack (I already did few implementations for dynamic styling based on the feature values and rendered maps by the use of Geoserver WMS and SLD). About your workflow : it seems ok but I could not understand the part "get a KML file and render it as WMS" since basically WMS is a service that creates images dynamically based on your vector or raster data. In vector data case it is possible to delegate rendering to WMS with some specific styles which can be based on rules according to data set.

  • Thanks for your answer ! I will try to clarify "get a KML file and render it as WMS": GeoDjango makes it very easy and powerful to manipulate (filter, styling decisions, ...) my data... The drawback is that GeoDjango output is always in a vector format (KML or others). I'd prefer to get an image (WMS protocol), as it will let the CPU/mem charge on the server instead of the browser. Finally, I'd like to add caching because my data never changes. Hope this helps.
    – niconoe
    Jun 30, 2011 at 13:11
  • 1
    I see. Maybe there can be better solutions but it looks like you can do all the manipulations in GeoDjango on server side and then you can feed the GeoServer with your dataset. Then you can use default styles or by the use of SLD you can make styled map requests to WMS. For filters you can use the similar approach : You can use OGC filtering capabilities and when they are not enough can use your server side solutions This is more or less can be done with the "Openlayers - GeoWebCache - GeoServer - PostGIS" stack as capdragon mentioned...
    – yteslax
    Jun 30, 2011 at 13:22

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.