Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid sld for graduated style on field with negative values #20078

Closed
qgib opened this issue Dec 15, 2014 · 4 comments
Closed

invalid sld for graduated style on field with negative values #20078

qgib opened this issue Dec 15, 2014 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Dec 15, 2014

Author Name: Maarten Pronk (Maarten Pronk)
Original Redmine Issue: 11863
Affected QGIS version: 2.6.1
Redmine category:expressions


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.


@qgib
Copy link
Contributor Author

qgib commented Mar 30, 2015

Author Name: Richard Duivenvoorde (@rduivenvoorde)


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


  • fixed_version_id was configured as Version 2.8.2
  • category_id was changed from Symbology to Expressions
  • 8552 was configured as issue.zip

  • issue.zip (Richard Duivenvoorde) - exampe project, shape plus invalid sld

@qgib
Copy link
Contributor Author

qgib commented Apr 3, 2015

Author Name: Richard Duivenvoorde (@rduivenvoorde)


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.

#1975

is my try to fix this...

@qgib
Copy link
Contributor Author

qgib commented May 4, 2015

Author Name: Martin Dobias (@wonder-sk)


Fixed in changeset "f800ac635b9f98d53becb721a1fd8f27c233a55c".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented May 8, 2015

Author Name: Richard Duivenvoorde (@rduivenvoorde)


  • fixed_version_id was changed from Version 2.8.2 to Version 2.10

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions labels May 25, 2019
@qgib qgib added this to the Version 2.10 milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Projects
None yet
Development

No branches or pull requests

1 participant