Bug report #6413

Support SLD with multiple FeatureTypeStyles

Added by dr - over 7 years ago. Updated about 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:15665

Description

I have the following SLD description:

<StyledLayerDescriptor version="1.0.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ogc="http://www.opengis.net/ogc" xmlns="http://www.opengis.net/sld">
<NamedLayer>
<Name>test</Name>
<UserStyle>
<Name>test</Name>
<FeatureTypeStyle>
<Rule>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke">#dddddd</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#fa5000</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

When I try to render layer using this SLD by GeoServer I get expected result. In QGIS result is strange, it looks like QGIS doesn't support multiple FeatureTypeStyles sections within one SLD.

geoserver_sld.png - Geoserver (8.82 KB) dr -, 2012-09-26 02:41 AM

qgis_sld.png - QGIS (11.4 KB) dr -, 2012-09-26 02:41 AM

Associated revisions

Revision c49a18c5
Added by Roel Huybrechts about 2 years ago

Add support for reading SLD's with multiple FeatureTypeStyle elements.

Introduce a virtual FeatureTypeStyle to add support for reading SLD documents with more than one FeatureTypeStyle element.

Still supports SLD's with one FeatureTypeStyle, as well as SLD's with multiple FeatureTypeStyles, including empty FeatureTypeStyles (not breaking single symbol rendering in that case). Complies with SLD's painter's model for rendering, appending Rules from subsequent FeatureTypeStyles in order.

Fix #6413 (http://hub.qgis.org/issues/6413)

History

#1 Updated by Giuseppe Sucameli over 7 years ago

  • Priority changed from High to Normal

SLD docs containing multiple FeatureTypeStyle are not supported yet.

#2 Updated by Paolo Cavallini over 7 years ago

  • Assignee changed from Giuseppe Sucameli to anonymous -

#3 Updated by Jürgen Fischer almost 7 years ago

  • Assignee deleted (anonymous -)

#4 Updated by Jürgen Fischer almost 6 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#5 Updated by Roel Huybrechts over 5 years ago

I added support for this in Github pull request 1894: https://github.com/qgis/QGIS/pull/1894

I'm open to comments and improvements here as well as on the Github page.

#6 Updated by Luigi Pirelli about 3 years ago

confirmed that PR fix the error. The imported sld is converted in rule based with a rule for each FeatureStyle.

tested on 2.18 e35939

#7 Updated by Luigi Pirelli about 3 years ago

approved the PR, can be merged to fix.

Would be necessary to port the PR to QGIS3

#8 Updated by Giovanni Manghi about 3 years ago

  • Regression? set to No
  • Easy fix? set to No

#9 Updated by Andrea Aime over 2 years ago

  • Description updated (diff)

Hi Luigi, any reason why this ticket is still open?

#10 Updated by Giovanni Manghi over 2 years ago

  • Status changed from Open to Feedback

#11 Updated by Giovanni Manghi over 2 years ago

  • Status changed from Feedback to Open
  • Pull Request or Patch supplied changed from No to Yes

Andrea Aime wrote:

Hi Luigi, any reason why this ticket is still open?

it seems the PR misses a unit test.

#12 Updated by Roel Huybrechts about 2 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF