Feature request #6598

Singleband pseudocolor classification

Added by David Shean almost 8 years ago. Updated over 7 years ago.

Assignee:Radim Blazek
Pull Request or Patch supplied:No Resolution:fixed
Easy fix?:No Copied to github as #:15788


The new support for singleband pseudocolor (see "#6443":#6443) is great.

However, a few small changes would improve usability. The larger issue is the default equal-interval classification.

To apply a colorramp to singleband raster data, the user must currently:
-specify min/max values using percentile, stddev or manual input
-click load
-select a color ramp
-specify enough classes to avoid undersampling the specified color ramp. The default of 5 is not nearly enough for more complex color ramps (e.g. spectral).
-click classify
-click apply

Ideally, the default functionality would eliminate some of these steps. Specifically, after choosing min/max values and a color ramp, the user should not have to do any classification - the color ramp should automatically be scaled for the full range. Previous versions of QGIS (up to 1.8) behaved this way for 'Pseudocolor', although the only option for setting min/max values was stddev multiplier.

One potential implementation would be to define a new Mode (perhaps 'Continuous' or 'Automatic'), which would disable the number of classes dialog and Classify button, and automatically generate the color map when the min/max values are loaded or a new color ramp is selected. Behind the scenes, this may involve automatic assignment of an appropriate number of classes for the selected color ramp. The user would then have the option to select Mode 'Equal interval' to manually define the classification.

A related issue with the current classification for 32-bit data - raster values greater than the specified max value (assigned to the highest class) are displayed as nodata (like singleband gray 'Stretch and Clip to MinMax'), while those less than the specified min value have the same color as the lowest class (like singleband gray 'Stretch to MinMax'). The highest class should be inclusive as well. The 'Contrast enhancement' defaults in Preferences don't seem to change the behavior for classification.

I recommend the default color ramp (currently 'Blues') be set to something like 'spectral', or the previous QGIS Pseudocolor ramp. This default should have reds for the highest values and blues for the lowest values. It would be nice if the user could set a default color map in Preferences along with default Contrast ehancement.

I suggest renaming 'Invert colors order' label to 'Invert'. Also, when clicked, this could automatically invert the present classification.

Any/all of these are open for discussion - I just wanted to get everything written down while I'm thinking about it. Thanks.


#1 Updated by David Shean almost 8 years ago

Alternatively, would it be simpler to modify the "Singleband gray" Render type to support a full set of color gradients (currently limited to Black to white, White to black)? This would satisfy the above request for a continuous color ramp. An 'invert' checkbox would be needed.

If so, perhaps "Singleband pseudocolor" could become "Classified" and retain its current functionality.

#2 Updated by Radim Blazek over 7 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

I have done most of that in 9fce669b.

  • new optional continuous mode which is using the breaks defined in palette
  • min/max values are automatically loaded if empty using current (default) min/max options
  • last selected color palette is remembered
  • values outside range are rendered until new 'Clip' option is checked

I don't think that changes in 'Generate new color map' widget should take effect immediately.

Regarding extension of single band gray to colors, I think that single band pseudocolor could be instead extended (just add single color ramps) to be used instead of single band gray. However, both are there and working and I would keep them both in 2.0.

Also available in: Atom PDF