Bug report #15430
SLD export does not account of attribute based symbology
|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
#1 Updated by Giovanni Manghi about 4 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
<se:Rule> <se:Name></se:Name> <!--Parser Error: syntax error, unexpected ELSE - Expression was: ELSE--> <se:PolygonSymbolizer> <se:Fill> <se:SvgParameter name="fill">#9a5ceb</se:SvgParameter> </se:Fill> <se:Stroke> <se:SvgParameter name="stroke">#000001</se:SvgParameter> <se:SvgParameter name="stroke-width">1</se:SvgParameter> <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter> </se:Stroke> </se:PolygonSymbolizer> </se:Rule>
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 about 4 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).
#4 Updated by Andrea Aime about 4 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.