Bug report #17793

Exporting SLD : "ELSE" rule doesn't export, making the style unusable

Added by Olivier Dalang over 2 years ago. Updated over 1 year ago.

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

Description

Hi !

The "ELSE" rule in rule based symbology is extremely useful. But when exporting to SLD, the rule gets transformed to :

...
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>A regular rule that works well</se:Name>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:Not>
              <ogc:PropertyIsNull>
                <ogc:PropertyName>waterway</ogc:PropertyName>
              </ogc:PropertyIsNull>
            </ogc:Not>
          </ogc:Filter>
          ...
        </se:Rule>
        <se:Rule>
          <se:Name>All other features</se:Name>
          <!--Parser Error: syntax error, unexpected ELSE - Expression was: ELSE-->
          ...
        </se:Rule>
...

So we get that <!--Parser Error...--> block instead of the whole <ofc:Filter> block.

This means that there's no filter for that rule, making it apply to all features, and thus making the map unreadable.

I don't know if SLD allows for something like "ELSE" ? If not, maybe we could just simulate it by using <ogc:Not> filter and putting all other layers conditions in there ? That may be a bit messy for complex rules... but would work well for simple ones, and would be consistent with what we do for rules groups.

Thanks !!

History

#1 Updated by Giovanni Manghi over 1 year ago

  • Status changed from Open to Feedback

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

Also available in: Atom PDF