Bug report #15430

SLD export does not account of attribute based symbology

Added by Andrea Aime almost 8 years ago. Updated over 5 years ago.

Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:23356


Several of the styling properties can be linked to attributes or built using expressions. SLD has the same ability (since SLD 1.0 and onwards) but the SLD exporter ignores attribute/expression and falls back on static values instead

Related issues

Duplicates QGIS Application - Bug report #14170: <se:ElseFilter/> nor working when styling data with sld Open 2016-01-26


#1 Updated by Giovanni Manghi over 7 years ago


I just noticed that when exporting rule based symbology to SLD where there is a rule where the filter is "ELSE" (to define a symbology class that must be applied when features do not match previous expressions) the "ELSE" is always stripped from the resulting SLD

          <!--Parser Error: syntax error, unexpected ELSE - Expression was: ELSE-->
              <se:SvgParameter name="fill">#9a5ceb</se:SvgParameter>
              <se:SvgParameter name="stroke">#000001</se:SvgParameter>
              <se:SvgParameter name="stroke-width">1</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>

When re-used in QGIS the result is a rule with no filter "ELSE", so this symbology class will always be applied to all features.

Is the same issue described in this ticket?

I also noticed that in recent QGIS releases the tickness of polygons border lines is exported bigger than should be. At least up to QGIS 2.8.* this was working as expected.

#2 Updated by Andrea Aime over 7 years ago

The use case above is for "<ElseFilter/>", not linked to property based symbology as I defined it above (as in, having a single property, e.g., thickness, use directly an attribute).

About the thickness, it was too small before, and has been fixed, at least when you are exporting while the properties are defined in mm, since SLD only knows about pixels. If you have a case where the unit is pixels and it's not exported using the correct value please open a separate ticket (I do not monitor redmine btw, better discuss also on the list).

#3 Updated by Alessandro Pasotti over 7 years ago

  • Resolution set to duplicate
  • Status changed from Open to Closed

This is a duplicate of #14170

#4 Updated by Andrea Aime over 7 years ago

I believe this report got misunderstood and wrongly closed.... this was was about symbols using attributes directly for widths, colors, shapes (e.g., fillColor = myFeatureAttribute), not about using filters to match them. The expression is in the symbolizer here, not in the filter.

#5 Updated by Giovanni Manghi over 7 years ago

  • Status changed from Closed to Reopened
  • Resolution deleted (duplicate)

#6 Updated by Giovanni Manghi about 7 years ago

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

#7 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Reopened to Feedback

Please check if this issue is still valid on QGIS 3.4.5 or 3.6.

Also available in: Atom PDF