[GIS] Qgis exported SLD file is not valid on Geoserver

geoserverqgissld

i'm trying to export my symbols from Qgis as an SLD file to use it as a style for the layer in geoserver here is an example of my SLD:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" units="mm" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
<NamedLayer>
<se:Name>stclines_streets</se:Name>
<UserStyle>
<se:Name>stclines_streets</se:Name>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Single symbol</se:Name>
<se:LineSymbolizer>
<se:Stroke>
<se:SvgParameter name="stroke">#d575ef</se:SvgParameter>
<se:SvgParameter name="stroke-width">0.26000000000000001</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
<se:SvgParameter name="stroke-linecap">square</se:SvgParameter>
</se:Stroke>
</se:LineSymbolizer>
<se:LineSymbolizer>
<se:Stroke>
<se:GraphicStroke>
<se:Graphic>
<se:Mark>
<se:OnlineResource xlink:type="simple" xlink:href="ttf://Dingbats"/>
<se:Format>ttf</se:Format>
<se:MarkIndex>65</se:MarkIndex>
<se:Fill>
<se:SvgParameter name="fill">#ff0000</se:SvgParameter>
</se:Fill>
</se:Mark>
<se:Size>2</se:Size>
</se:Graphic>
<se:Gap>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:Literal>3</ogc:Literal>
</ogc:Filter>
</se:Gap>
</se:GraphicStroke>
</se:Stroke>
</se:LineSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

this doesn't work for any complex multi symbols like lines with graphical hashes and so. even when i try using Qgis plugin " geoserver explorer " to publish it the published SLD file ignore that multi symbols or font symbol at all however when i go to SLD cookbook and take some code samples for some complex symbols but in v 1.0.0 it kinda works, but i need the advanced options in GUI that QGIS has.

i read in that thread that QGIS produce 1.1.0 while geoserver validate 1.0.0 SLDs but i'm looking for an update for that issue or is it still ?thread link

Best Answer

Current QGIS releases export invalid SLD 1.1 in various ways. In your example, you should amend the gap this way:

<se:Gap>3</se:Gap>

There are also other issues like wrong sizes and the custom usage of the mark index, that no released version of GeoServer can handle (but it's already in, GeoServer 2.9.2 will have that improvement).

Future versions of QGIS will have less of these problems, we made some fixes and improved compatibility during the FOSS4G 2106 code sprint, which will end up in QGIS 3.0 (backport pending, not ETA at the moment). See my recent summary mail here: http://osgeo-org.1560.x6.nabble.com/FOSS4G-code-sprint-idea-improving-SLD-export-and-GeoServer-compatibility-tt5273812.html#a5283626

Related Question