Bug report #11863
invalid sld for graduated style on field with negative values
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Expressions | ||
Affected QGIS version: | 2.6.1 | Regression?: | No |
Operating System: | Linux, Windows | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 20078 |
Description
When creating a graduated style on a field with negative values, the resulting sld file has the following xml:
<ogc:PropertyIsLessThanOrEqualTo>
<ogc:PropertyName>value</ogc:PropertyName>
<ogc:Literal>-<ogc:Literal>0.786648</ogc:Literal>
</ogc:Literal>
</ogc:PropertyIsLessThanOrEqualTo>
The sld has a Literal within a Literal. Loading the same sld back into QGIS produces rules with || like:
value > '-' || 4.45316 AND value <= '-' || 0.786648
Which results in the same visualization for all negative fields.
Affects 2.4 to 2.6.1, probably also older versions. Tested on different layers, with different fields on Windows & Linux.
Associated revisions
History
#1 Updated by Richard Duivenvoorde over 9 years ago
- Target version set to Version 2.8.2
- Category changed from Symbology to Expressions
- File issue.zip added
I've been trying to debug this, and it appears that for the creation of the sld qgsexpression is used.
And after the parsing of an expression string like:
foo > -0.01 AND foo <= -0.001
the minus signs are seen/parsed as unary operators instead of a minus+doube
adding an example project so hopefully somebody more into this part of the code is able to debug/fix it better
#2 Updated by Richard Duivenvoorde over 9 years ago
According to others it is not the parsing that is the problem,
it is the xml/sld generation which does not take the unary-minus into account.
https://github.com/qgis/QGIS/pull/1975
is my try to fix this...
#3 Updated by Martin Dobias over 9 years ago
- Status changed from Open to Closed
Fixed in changeset f800ac635b9f98d53becb721a1fd8f27c233a55c.
#4 Updated by Richard Duivenvoorde over 9 years ago
- Target version changed from Version 2.8.2 to Version 2.10