In Open Source software development, there is a strong tendency to create software having precise objectives. It is thought that a good specific tool is better than a complex and complicated one. A project is consequently made up of several applications, often coming from various projects. The role of the integrator is to implement the infrastructure and the components interaction, both preferably based on OGC standards (such as the geOrchestra project, for instance).

GeoServer is one of the applications used in geOrchestra but it is not the only one (and geOrchestra is not the only project using the power GeoServer provides). This article will therefore interest all GeoServer users and/or QGIS users.

Since QGIS 1.8 has been released, it is possible to export QGIS styles in the SLD 1.1 format. The idea is to use this program’s function to style GeoServer’s WMS layers.

The process is simple:

  1. Style the layer in QGIS;

  2. Import the style in GeoServer;

  3. Test the WMS flow.

 

Style the layer in QGIS

Enter the GeoServer’s WFS flow configuration (for instance http://localhost:8080/geoserver/wfs for a default installation off-line) and connect to the service. The list of layers is now available. In this example, we chose the « topp:states » layer.

Double click on the layer’s name to open the pop-up entitled « Layer Property » then click on the tab « Style« . In our example, we created a theme on the « SUB_REGION » category. Then, save the style in the SLD format.

QGIS created a SLD in v. 1.1 while GeoServer manages only v. 1.0. Actually, from GeoServer v. 2.1.0, a first implementation has been completed.

 

SLD 1.1 / SE 1.1 enhancements

Though not every new option is fully-supported, it is now possible to use most SE 1.1 documents in GeoServer.

User feedback on which new options should be supported first is greatly appreciated.

Also funded by Ordnance Survey is a community module to implement the WMS extensions for INSPIRE View Service compliance—namely the language parameter and several extended capabilities fields.

Source : http://blog.geoserver.org/2011/05/12/geoserver-2-1/

 

Import the style in GeoServer

Next step is similar to the GeoServer interface’s. You have to create a new style:

  • Go the the style manager;
  • Click on « New style » ;
  • Name the style, then select « Browse » to get the SLD file you just created, then on the link « Load » ;
  • Save the page ( without validating it !).

Now, this style needs to be added to the styles available for this layer. Click on Layer in the menu on the left than go in the Publication tab. The interface is listing all styles which are available; select the one you just added and click on the arrow pointing right.

Save the configuration.

 

Test the WMS flow

Now, you can enjoy your work. Open the window which ables to add WMS layers and set up a new service (just as you did for the WFS flow). Add the layer topp:states (if you used this layer) and choose the style just created (in our case topp_state_subregion). The layer is displayed with the same style as the WFS flow’s.

QGIS offers a Python API to create extensions. GeoServer offers also one but in REST in order to manage GeoServer remotely. These 2 APIs can add excellent features to QGIS!

You can get the style file in the SLD format and test it in your GeoServer instance. Data will be installed by default.

Carrière

Vous souhaitez travailler dans un environnement inspirant et rejoindre nos équipes motivées et multiculturelles ?