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.
Hi,
ReplyDeleteIt looks pretty great !
I suppose you stored the plugin in http://pyqgis.org/repo/contributed, but unfortunately, it seems broken. Could you post somewhere a link where to download the plugin, please ? I'm eager to test it !
Thanks,
Jean
Thank you!
ReplyDeleteYes, you're right, there seems to be a problem with the above link. Try http://pyqgis.org/admin/contributed/python_plugins/list?page=9 or the direct link http://spatialserver.net/pyqgis_1.0/contributed/saveassld.zip.
Hope that helps!
I copied the folder into ./qgis/python/plugins but don't see it when i open QGIS...
ReplyDeleteIt 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.
ReplyDeleteThis 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.
Hi!
ReplyDeleteThis 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?
Yes, there are still unsupported symbols, but I'm working on it ;) What do you need? Please send me a private message.
ReplyDeleteI fully agree that the vision is to have a direct bridge to GeoServer (or other SLD-compliant GIS)
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.
ReplyDeleteWish I could help out somehow. I have a some Python experience, and very little Java
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.
DeleteIf 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.
This is the (large) commit: http://hub.qgis.org/projects/quantum-gis/repository/revisions/84be523ba7722b540c9af0a18930ae905c65cd98
DeletePlain 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?
DeleteNot sure about that, but I don't suppose so.
Delete... now the possibility to upload the style directly to GeoServer.
ReplyDelete\m/ great!
Hi, I am interested in this tools where can I get it as I click the links above are brokens.
ReplyDelete-the first value of the first rule- not render in sld.
ReplyDeletein SldGraduatedSymbolRenderer.py there is a ogc:PropertyIsGreaterThan
but it's change in
ogc:PropertyIsGreaterThanOrEqualTo
in the first rule only...!!
As already stated in some comments, the above links don't work anymore. Please find the plugin currently at http://pyqgis.org/contributed/saveassld.zip
ReplyDeleteThis link no longer works.
Delete