Bug report #17056

exporting categorized symbology to sld then importing results in all features having the no-filter value

Added by Paul van Genuchten over 6 years ago. Updated about 5 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Symbology
Affected QGIS version:2.18.0 Regression?:No
Operating System:macos Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:24955

Description

this may relate to issue #16706

when i export a categorized symbology to sld and then import it
all features recieve the no-filter symbology

the type of symbology is converted to rule-based
and the rule "no-filter" always applies so it overwrites any matching rules before

i'm not sure how this can best resolved, some suggestions
- apply the no-filter case first, then all subsequent filter matches will overwrite is (may give problems in semi transparent styles)
- apply the no-filter case only if no other filters match

first.png (221 KB) Anton Bakker, 2017-11-06 11:38 AM

last.png (196 KB) Anton Bakker, 2017-11-06 11:38 AM


Related issues

Related to QGIS Application - Bug report #16706: Rule based symbology matching "lack of value" is not prop... Closed 2017-06-12

History

#1 Updated by Jürgen Fischer over 6 years ago

  • Description updated (diff)

#2 Updated by Jürgen Fischer over 6 years ago

  • Related to Bug report #16706: Rule based symbology matching "lack of value" is not properly encoded in SLD added

#3 Updated by Paul van Genuchten over 6 years ago

from my perspective "lack-of-value" is properly encoded in SLD, it is however not correctly interpreted by the SLD importer

<se:Rule> 
          <se:Name>Achterhoek</se:Name>
          <se:Description>
            <se:Title>Achterhoek</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>omgdnst_nm</ogc:PropertyName>
              <ogc:Literal>Achterhoek</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
...
<se:Rule> <!-- all features get this style in qgis, seems this rule is interpreted as "always applies", and since it is last, it overwrites previous styles -->
          <se:Name></se:Name>
          <se:Description>
            <se:Title>omgdnst_nm is ''</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>omgdnst_nm</ogc:PropertyName>
              <ogc:Literal></ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>

this last rule is interpreted as <rule label="omgdnst_nm is ''" key="{5a36ca93-4ba6-4b1e-a0b5-e2ad19fb4387}" symbol="7"/>

in stead it should be interpreted as

<rule filter="omgdnst_nm = ''" label="omgdnst_nm is ''" key="{5a36ca93-4ba6-4b1e-a0b5-e2ad19fb4387}" symbol="7"/>

however this gives the problem that features with value '' are not displayed anymore in qgis, this is what andrea speaks about in #16706

Curiously this filter works: concat(omgdnst_nm,'dummy')='dummy'

#4 Updated by Anton Bakker over 6 years ago

I found that when the "other" filter class is listed first in class list this class is not overwriting the other classes, but is when this class is last in the class list. So when loading an SLD, when the rule of a filter class is empty it should be inserted at the top of the classes list.

Other class last

Other class first

#5 Updated by Richard Duivenvoorde over 6 years ago

1) Is it possible to create/add a little dataset+sld's to this issue? So we all talk about the same things/rules?

2) Note that Andrea Aime has done a lot of sld related work in current master (upcoming 3.0), which was very hard to backport to 2.18.
So I would recommend to check if this is still the case in current master, and then fix (only) there.

3) Note that for what I know QGIS is always morphing it's own categorized and graduated styling to rulebased styling when EXPORTING to sld.
When IMPORTING sld, it always becomes rule based symbology if I am right?

Some questions I am curious about are:

- if several rules apply (like a match and a 'catch all' rule), should QGIS (and also in the sld world) then apply both rules, or only the first one matching? Because in the second case, ORDER of the rules becomes very important.

- is handling quotes, emtpy values and null values the same between QGIS and sld/geoserver?

#6 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Open to Feedback

#7 Updated by Federico Gianoli about 6 years ago

Anton Bakker wrote:

I found that when the "other" filter class is listed first in class list this class is not overwriting the other classes, but is when this class is last in the class list. So when loading an SLD, when the rule of a filter class is empty it should be inserted at the top of the classes list.

The same issue persist on QGIS 3.0 (running on windows 10)

#8 Updated by Jürgen Fischer over 5 years ago

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#9 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Feedback to Closed

End of life notice: QGIS 2.18 LTR

Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/

QGIS 3.4 has recently become our new Long Term Release (LTR) version. This is a major step in our history – a long term release version based on the massive updates, library upgrades and improvements that we carried out in the course of the 2.x to 3x upgrade cycle.

We strongly encourage all users who are currently using QGIS 2.18 LTR as their preferred QGIS release to migrate to QGIS 3.4. This new LTR version will receive regular bugfixes for at least one year. It also includes hundreds of new functions, usability improvements, bugfixes, and other goodies. See the relevant changelogs for a good sampling of all the new features that have gone into version 3.4

Most plugins have been either migrated or incorporated into the core QGIS code base.

We strongly discourage the continued use of QGIS 2.18 LTR as it is now officially unsupported, which means we’ll not provide any bug fix releases for it.

You should also note that we intend to close all bug tickets referring to the now obsolete LTR version. Original reporters will receive a notification of the ticket closure and are encouraged to check whether the issue persists in the new LTR, in which case they should reopen the ticket.

If you would like to better understand the QGIS release roadmap, check out our roadmap page! It outlines the schedule for upcoming releases and will help you plan your deployment of QGIS into an operational environment.

The development of QGIS 3.4 LTR has been made possible by the work of hundreds of volunteers, by the investments of companies, professionals, and administrations, and by continuous donations and financial support from many of you. We sincerely thank you all and encourage you to collaborate and support the project even more, for the long term improvement and sustainability of the QGIS project.

Also available in: Atom PDF