Bug report #14170

<se:ElseFilter/> nor working when styling data with sld

Added by Radek Zdansky about 8 years ago. Updated over 5 years ago.

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

Description

As is stated in the description, <se:ElseFilter/> is not working properly when styling data with sld (tested in 2.8.3 and 2.12.3)

QGIS just styles data as though there was no ElseFilter, so if I want to use a default style that should be used on all objects that have met no filter in sld file, QGIS styles all the data regardless with that default style in addition to any rules that have been met - therefore rendering them twice. This is a problem when rendering icons especially, because they overlap, which is not very visually appealing.

I have attached two images to let you see what I mean.

QGIS:

GeoServer, using the same sld:

I have attached my shp and sld in a rar, so it could be tested more.

dopravni_znacky.rar - <se:ElseFilter> (3.87 KB) Radek Zdansky, 2016-01-26 04:31 AM

Screenshot_20171016_113426.png (231 KB) Giovanni Manghi, 2017-10-16 12:34 PM


Related issues

Duplicated by QGIS Application - Bug report #15430: SLD export does not account of attribute based symbology Feedback 2016-08-12

History

#2 Updated by Alessandro Pasotti over 7 years ago

  • Category changed from Browser to Symbology

Apparently, when converting to rule-based an ELSE expression is inserted as last default rule but when converting (exporting) to SLD the rule expressions are evaluated and "ELSE" is not a valid expression, this leads to a "Parse error" that is shown in the exported SLD and an empty filter is created instead of an ElseFilter, the empty filter is applied to all features instead of being applied only to the features that do not match any of the previously defined filters.

There is another related issue when you import the SLD containing the ElseFilter from geoserver into QGIS because QGIS do not understand the ElseFilter and creates an empty filter that matches all features.

#3 Updated by Giovanni Manghi almost 7 years ago

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

#4 Updated by Andrea Aime over 6 years ago

  • Description updated (diff)

Question, does QGIS even have a concept of "else filter"? That is, a rule that will match anything that has not been captured by a previous rule, and only that? In other words, it would be something like "not (filterOfRule1 OR filterOfRule2 OR ... filterOfRuleN)"

I've tried to play with rule based symbology and could not find a direct way to express that. It could be that importing such filters really requires builting the negation of the OR of all previous filter rules

#5 Updated by Giovanni Manghi over 6 years ago

Andrea Aime wrote:

Question, does QGIS even have a concept of "else filter"? That is, a rule that will match anything that has not been captured by a previous rule, and only that? In other words, it would be something like "not (filterOfRule1 OR filterOfRule2 OR ... filterOfRuleN)"

I've tried to play with rule based symbology and could not find a direct way to express that. It could be that importing such filters really requires builting the negation of the OR of all previous filter rules

see attached image(?)

#6 Updated by Bo Thomsen over 5 years ago

To answer Andrea's question: Yes- QGIS rule based styling has a "else" clause.

And the pertaining error: Importing A SLD stylefile with an <se:ElseFilter/> element into QGIS still produces an all-inclusive style rule (without the "else" clause) in QGIS. Shouldn't this be an easy fix ?

The error is still present in QGIS ver. 3.2

#7 Updated by Giovanni Manghi over 5 years ago

  • Affected QGIS version changed from 2.12.2 to 3.2

Also available in: Atom PDF