Thursday, October 13, 2011

Save As SLD 0.3.0 released

When I developed the Save As SLD QGIS plugin some months ago, I did it for my own purpose to publish simple choropleth maps with GeoServer and I implemented solely renderers and styling options I needed (and a little bit more). That's the reason why this plugin still lacks a lot of features.

Later on I thought about a tighter integration with GeoServer than to save first a SLD file and then upload or copy-and-paste to GeoServer. Using GeoServer's REST API the SLD preview dialog features now the possibility to upload the style directly to GeoServer.

SLD Preview dialog

As parameters the GeoServer URL, user name and password and a layer name are required. The URL has to point to the REST API usually ending with /geoserver/rest/. The REST API was introduced with GeoServer version 2.1, for older version it can be installed as an extension.
From the technical side: The network communication is done using QNetworkAccessManager and QNetworkRequests. A new style is created by POSTing the SLD to /geoserver/rest/styles.sld?name=. Authentication is done using basic access authentication as required by GeoServer. The server returns a 403 Forbidden status code if there is already a style with the same name.

Important: Consider it as a proof-of-concept, it is far from complete! And as always, feedback is highly appreciated.


  1. Hi,
    It looks pretty great !
    I suppose you stored the plugin in, but unfortunately, it seems broken. Could you post somewhere a link where to download the plugin, please ? I'm eager to test it !


  2. Thank you!
    Yes, you're right, there seems to be a problem with the above link. Try or the direct link
    Hope that helps!

  3. I copied the folder into ./qgis/python/plugins but don't see it when i open QGIS...

  4. It is necessary to load the plugin in the QGIS Plugin Manager ("Plugins" -> "Manage Plugins"), see also chapter 11 in the QGIS manual to get more information about loading plugins.

    This plugins does not (yet?) add a new button to the plugins toolbar, it add only a new menu entry "Save Style As SLD" in the "Plugins" menu.

  5. Hi!
    This plugin seems extremely useful, but I'm getting lots of

    in the generted SLD.

    Is it possible to improve the generator?

    I hope with time and effort it can grow up to something similar to GeoCAT Bridge. A kind of a geoserver control panel plugin. What do you think?

  6. Yes, there are still unsupported symbols, but I'm working on it ;) What do you need? Please send me a private message.
    I fully agree that the vision is to have a direct bridge to GeoServer (or other SLD-compliant GIS)

  7. This is an awesome and most useful plugin for a GeoServer beginner like myself. I'm having problems using the rule-based symbolizer as well as categorized by an attribute. GeoServer "validates" but doesn't work.

    Wish I could help out somehow. I have a some Python experience, and very little Java

    1. In the current master branch (the development version) QGIS supports natively SLD, it is now possible to save and load styles as SLD. That's why this plugin will be needless very soon apart from the GeoServer interface.

      If you're mainly interested in the SLD export I recommend you to update QGIS, only if you're interested in the GeoServer interface, it makes sense to start a new plugin or refactor the existing one. GitHub would be of course a very suitable development platform.

    2. This is the (large) commit:

    3. Plain SLD is very often lacking, GeoServer has a number of extensions on top of it that allow for better map styling. Do you know if these will be supported as well?

    4. Not sure about that, but I don't suppose so.

  8. ... now the possibility to upload the style directly to GeoServer.

    \m/ great!

  9. Hi, I am interested in this tools where can I get it as I click the links above are brokens.

  10. -the first value of the first rule- not render in sld.
    in there is a ogc:PropertyIsGreaterThan
    but it's change in
    in the first rule only...!!

  11. As already stated in some comments, the above links don't work anymore. Please find the plugin currently at