Search This Blog

Monday, 10 August 2015

Layer Styling, SLD file, OpenWebGIS and QGIS

A Styled Layer Descriptor (SLD) is an XML schema specified by the Open Geospatial Consortium (OGC) for describing the appearance of map layers. It is capable of describing the rendering of vector and raster data. Using SLD provides a lot of convenience when working with GIS as it allows to save the layer style separately from the map (layer) and to use it in other projects or other softwares.
In this regard, recently in OpenWebGIS the new feature has been added which allows to change the legend (style) vector layers of the map using SLD files. OpenWebGIS users can apply their SLD files, that were created by other software, and they can also export the layer style, that was created with the help of OpenWebGIS, in the SLD file and use it in other Geographic Information System (GIS) programs such as the QGIS. To import your legend (style) in a single SLD file you need to select the menu item  "Edit-> Import / Export SLD legend". Then select layer name (in this case, "Cities") from the list "Select the Layer:" which style you want to export to a SLD file and click "Export legend to SLD" (see Figure 1).  
Figure 1.

After clicking this button the window opens with the file contents, which you can save on your hard drive by pressing the "Save Data" (see Figure 2). 
Figure 2.

Then you can use this file, for example, for changing the "Cities" layer style previously added to QGIS. To do this, in the QGIS interface right click on the layer name to open the context menu and select the menu item "Properties" (see Figure 3).
Figure 3.

In the window that appears, click  "Style" button, then "Load Style" and set the path to the saved SLD file (see Figure 4), then click “Apply” button  and you will see the result shown in Figure 5.
Figure 4.
Figure 5.
The above describes a simple example, when the style is a "Single symbol". It works similarly, if in OpenWebGIS the sophisticated style was created - for example, when the size and color of the points, representing cities, vary depending on the size of the population living in them. This you can see in this video:

Then you can solve the reverse task - change the layer style in QGIS and apply it in OpenWebGIS. To do this using default tools of QGIS, change the layer style as it is shown in Figure 6 (for example, change the type of style "Graduated", select "Color ramp" you prefer, change the size of points, depending on the size of the city's population). After that, click on "Style" button, then select "Save Style" and “SLD File” (as shown in Figure 6).
Figure 6.

Then open OpenWebGIS in your browser, select the menu item "Edit-> Import / Export SLD legend". In the window that appears, enter the name of the layer which style you want to change and using the button "Browse" select SLD file that you created and saved using QGIS. And finally, click "Load (import) SLD". You will see the result shown in Figures 7 and 8.
Figure 7.

Figure 8.

No comments:

Post a Comment