[Qgis-user] Using QGIS to create Geoserver SLD

Richard McDonnell richard.mcdonnell at opw.ie
Tue Jul 19 04:48:40 PDT 2016


Hello all,

Ok, I have been looking at this for a while, and I think I have it 
nailed down pretty well.
There has been some issues with using QGIS SLD's in Geoserver.
The following should enable you to utilise the styling power of QGIS and 
make it compatible with Geoserver

In the main, this process only works for geometry, and will not work for 
styling text it may require some additional tweaking here and there also.

Firstly, style your layer the way you want.

Next save your style as a SLD.

Open the SLD in Notepad++ or other text editor

Create a new blank text document and use the following as a template:

*/<?xml version="1.0" encoding="ISO-8859-1"?>/*

*/<StyledLayerDescriptor version="1.0.0" /*

*/xsi:schemaLocation="http://www.opengis.net/sld 
StyledLayerDescriptor.xsd" /*

*/xmlns="http://www.opengis.net/sld" /*

*/xmlns:ogc="http://www.opengis.net/ogc" /*

*/xmlns:xlink="http://www.w3.org/1999/xlink" /*

*/xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">/*

*/<NamedLayer>/*

*/<Name>YourLayerName</Name>/*

*/<UserStyle>/*

*/<Title>YourLayerTitle</Title>/*

*/<FeatureTypeStyle>/*

*/<!-- Start -->/*

*/<!-- COPY AND PASTE QGIS SLD CODE BETWEEN <FeatureTypeStyle> and 
</FeatureTypeStyle> IN HERE-->/*

*/<!-- End --> /*

*/</FeatureTypeStyle>/*

*/</UserStyle>/*

*/</NamedLayer>/*

*/</StyledLayerDescriptor>/*

Copy the code between but excluding <FeatureTypeStyle> and 
</FeatureTypeStyle> and paste it into the new document overwriting 
*/<!-- COPY AND PASTE QGIS SLD CODE BETWEEN <FeatureTypeStyle> and 
</FeatureTypeStyle> IN HERE--> /*

Find and replace the following:

·*/se:/* with nothing (effectively deleting it) so for example where you 
have <se:Rule> it becomes <Rule>

·*/<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"> /*with 
*/<ogc:Filter>/*

·Delete all instances of */<Description>…..</Description>/* inclusive of 
everything in between (usually a Title)

·*SvgParameter *with *CssParameter

*

One other thing where you utilise Map units (meters, feet or pixel) in 
your styling you will have to use the following examples shown in the 
link below

http://docs.geoserver.org/latest/en/user/styling/sld-extensions/uom.html

I would ask the question, would it be possible to create a simple 
Geoserver Style using what I have found above?? adding an option to save 
the QGIS style using the above rules?

If anyone has any questions or needs any clarification let me know, If I 
can help I will.

Regards,

Richard McDonnell




OPW - Ag féachaint don am atá le teacht - Ag caomhnú ón am atá thart
OPW - Looking to the future - Caring for the past

***********************************************************
Email Disclaimer: http://www.opw.ie/en/disclaimer/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160719/cbb0496a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: richard_mcdonnell.vcf
Type: text/x-vcard
Size: 374 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160719/cbb0496a/attachment.vcf>


More information about the Qgis-user mailing list