Bug report #6096

Negative values are classified incorrectly using new symbology

Added by Wes Meltzer over 12 years ago. Updated almost 12 years ago.

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

Description

In the new symbology mode, at least in 1.8.0, several classification modes render negative real values as though they were positive values. This occurs with Quantile, Natural Breaks and Standard Deviation classifications. It also fails completely to classify percentages stored as reals (-1 to 1) in Equal Interval and Pretty Breaks modes.

I have import data (from either CSV or XLS) and join it to a vector layer. The data is attached, although with identifying information stripped out because it's embargoed.

The values range from -0.0791 to 0.0165 and are stored as reals. The classifications are a mess; for instance, here's the classification in Quantile mode, in order from lightest color to darkest for 7 categories:

0.0000 - -0.0342
-0.0342 - -0.0185
-0.0185 - 0.0000
0.0000 - 0.0000
0.0000 - 0.0000
0.0000 - 0.0000
0.0000 - 0.0165

I don't know why it includes three categories of 0-0, but it leads to misleading categorization. The data has a MIN of -0.0791 so it should be something like

-0.0791 - -0.0345
-0.0342 - -0.0185
-0.0185 - 0.0000
0.0000 - 0.0165

off the top of my head, although of course that's only 4 categories. There are 56 data points, so it's not for lack of trying.

sample_zip_code_data.xls - Sample data (19 KB) Wes Meltzer, 2012-07-25 08:48 AM

Screen_shot_2012-07-25_at_11.47.29_AM.png - Screen shot of categorization (86.7 KB) Wes Meltzer, 2012-07-25 08:48 AM

zipcodes_new.zip - ZIP code shapefile for Central Florida (1010 KB) Wes Meltzer, 2012-07-25 08:48 AM

Associated revisions

Revision 7c0746b0
Added by Nathan Woodrow almost 12 years ago

Merge pull request #453 from nyalldawson/gradfixes

Don't treat null values as zero for graduated symbology (Fix #6096)

History

#1 Updated by Giovanni Manghi over 12 years ago

  • Status changed from Open to Feedback
  • Category set to Symbology

Can you check if this is a regression since 1.7.4?

#2 Updated by Wes Meltzer over 12 years ago

Giovanni Manghi wrote:

Can you check if this is a regression since 1.7.4?

Short answer: no. I never upgraded from 1.7.1 to 1.7.4 (lazy) but this issue is present in 1.7.1. It's hard to believe I never had a data set consisting of mostly negative reals with 1.7!

Note: I discovered one issue that is a red herring. The weirdness with the excess 0.00 values listed above is actually a problem with the dataset the database reporter generated, which only showed up in quantiles mode. Too many null values. This is not an issue with the Quantiles categorization. The negative numbers issue remains if I change the mode, however.

Here is the Jenks categorization for 1.7.1 and 1.8.0:

0.0000 - -0.0714
-0.0714 - -0.0420
-0.0420 - -0.0282
-0.0282 - -0.0185
-0.0185 - -0.0083
-0.0083 - 0.0030
0.0030 - 0.0165

which is still erroneous without manually changing the order of processing. Top line should be -0.0791 - -0.0714.

#3 Updated by Giovanni Manghi over 12 years ago

  • Status changed from Feedback to Open
  • Target version set to Version 2.0.0

#4 Updated by Nyall Dawson almost 12 years ago

By my testing this is fixed by pull request 453:

https://github.com/qgis/Quantum-GIS/pull/453

#5 Updated by Nathan Woodrow almost 12 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF