[Qgis-user] Problems saving layer style as SLD for use in Geoserver 2.5
Chris Buckmaster
chris.buckmaster at runnymede.gov.uk
Mon Sep 14 06:54:20 PDT 2015
Hi Victor
Thanks very much for that info, I will give it a try.
Chris
-----Original Message-----
From: Victor Olaya [mailto:volayaf at gmail.com]
Sent: 14 September 2015 14:51
To: Chris Buckmaster
Cc: qgis-user at lists.osgeo.org
Subject: Re: [Qgis-user] Problems saving layer style as SLD for use in Geoserver 2.5
Chris,
The SLD written by QGIS is not compatible with the one expected by QGIS
The QGIS OpenGeo plugin [1] tries to solve that by converting it and modifying it. You can upload your layers and styles to GeoServer using the OpenGeo plugin.
If you want to automate that conversion or do it manually, you will find a convertQgsToGs() method in the sldadapter module of the plugin to do so (see [2])
Let me know if you have questions
Regards
[1] https://github.com/boundlessgeo/suite-qgis-plugin
[2] https://github.com/boundlessgeo/suite-qgis-plugin/blob/master/src/opengeo/qgis/sldadapter.py#L32
2015-09-11 15:51 GMT+02:00 Chris Buckmaster <chris.buckmaster at runnymede.gov.uk>:
> Hi
>
>
>
> I am trying to style my layers in Geoserver with the SLD files I am
> creating through QGIS but am encountering some errors, for example
> when using diagonal lines for a polygon layer:-
>
>
>
> · Parsing failed for Filter: java.lang.RuntimeException: Unable to
> find function Literal
>
> · line 23: cvc-complex-type.2.4.a: Invalid content was found
> starting with element 'ogc:Filter'. One of
> '{"http://www.opengis.net/ogc":expression}' is expected.
>
> · line 24: cvc-complex-type.2.4.a: Invalid content was found
> starting with element 'ogc:Literal'. One of
> '{"http://www.opengis.net/ogc":spatialOps,
> "http://www.opengis.net/ogc":comparisonOps,
> "http://www.opengis.net/ogc":logicOps,
> "http://www.opengis.net/ogc":_Id}' is expected.
>
>
>
> I have read that there are some issues when trying to use SLD
> generated files from QGIS in Geoserver as they are not set in the
> correct standard? Is that right? Are there any plugins that might
> export the styles out for use in Geoserver? I don’t really want to
> have to write all my styles from scratch L
>
>
>
> My SLD is below:-
>
>
>
> <?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"
> 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>air_quality_management_areas</se:Name>
> <UserStyle>
> <se:Name>air_quality_management_areas</se:Name>
> <se:FeatureTypeStyle>
> <se:Rule>
> <se:Name>Single symbol</se:Name>
> <se:PolygonSymbolizer>
> <se:Fill>
> <se:GraphicFill>
> <se:Graphic>
> <se:Mark>
> <se:WellKnownName>horline</se:WellKnownName>
> <se:Stroke>
> <se:SvgParameter
> name="stroke">#5c98e6</se:SvgParameter>
> <se:SvgParameter
> name="stroke-width">0.25</se:SvgParameter>
> </se:Stroke>
> </se:Mark>
> <se:Size>5</se:Size>
> <se:Rotation>
> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
> <ogc:Literal>45</ogc:Literal>
> </ogc:Filter>
> </se:Rotation>
> </se:Graphic>
> </se:GraphicFill>
> </se:Fill>
> </se:PolygonSymbolizer>
> <se:PolygonSymbolizer>
> <se:Fill>
> <se:GraphicFill>
> <se:Graphic>
> <se:Mark>
> <se:WellKnownName>horline</se:WellKnownName>
> <se:Stroke>
> <se:SvgParameter
> name="stroke">#5c98e6</se:SvgParameter>
> <se:SvgParameter
> name="stroke-width">0.25</se:SvgParameter>
> </se:Stroke>
> </se:Mark>
> <se:Size>5</se:Size>
> <se:Rotation>
> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
> <ogc:Literal>135</ogc:Literal>
> </ogc:Filter>
> </se:Rotation>
> <se:Displacement>
> <se:DisplacementX>0</se:DisplacementX>
> <se:DisplacementY>0</se:DisplacementY>
> </se:Displacement>
> </se:Graphic>
> </se:GraphicFill>
> </se:Fill>
> </se:PolygonSymbolizer>
> <se:LineSymbolizer>
> <se:Stroke>
> <se:SvgParameter name="stroke">#5c98e6</se:SvgParameter>
> <se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
> <se:SvgParameter
> name="stroke-linejoin">bevel</se:SvgParameter>
> <se:SvgParameter
> name="stroke-linecap">square</se:SvgParameter>
> </se:Stroke>
> </se:LineSymbolizer>
> </se:Rule>
> </se:FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
>
>
>
>
>
> Thanks, Chris
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
More information about the Qgis-user
mailing list