Bug report #11573

Int images with floating point gain not displayed properly

Added by Matthew Hanson over 9 years ago. Updated about 9 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Rasters
Affected QGIS version:2.6.0 Regression?:No
Operating System:Ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:19835

Description

In 2.4 a new feature was introduced that was to apply the gain and offset, if there was one, to the read and displayed image.

However QGIS appears to honor the original data type of the image after the gain and offset are applied.

To reproduce:
- Take an Int typed image with a floating point gain. For example, an NDVI image stored as Int16 might have a gain of 0.001 to yield values generally in the range of -1.0 to 1.0.

- Open in QGIS. The image will appear black/white/gray.

- Examine with Identify Feature. Image is made up of only -1's, 0's and 1's (depending on individual image), as if the gain was applied but the data type was still integer

Note that the statistics generated are properly in floating point. However the display, and the pixels as reported by Identify Feature, are ints.

This bug is present in 2.4 and 2.6. Verified on multiple Ubuntu desktop and server machines, both 12.04 and 14.04.

Associated revisions

Revision 914ecc9c
Added by Nyall Dawson about 9 years ago

Fix incorrect data type for GDAL layers with gain/offset (fix #11573)

Test was incorrectly checking for both offset and gain, when it
should have been testing for either.

Revision 326b4989
Added by Nyall Dawson about 9 years ago

Fix incorrect data type for GDAL layers with gain/offset (fix #11573)

Test was incorrectly checking for both offset and gain, when it
should have been testing for either.

History

#1 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback

please attach/link sample data.

#2 Updated by Matthew Hanson over 9 years ago

Link to example data.

TIF NDVI image. Int16, ranging from -26512 to 11716 with a gain of 0.0001:
http://geo.ags.io/static/2014141_LC8_ndvi.tif

QGIS 2.2 reports numbers as the original ints, and is correct (although without gain) in the above range.

QGIS 2.4, 2.6 reports numbers statistics properly as -2.6512 to 1.1716, but the image is displayed as all 0's.

With the gain removed 2.6 behaves as 2.2.

Same image, with no gain set:
http://geo.ags.io/static/2014141_LC8_ndvi_nogain.tif

#3 Updated by Matthew Hanson over 9 years ago

I would like to request that the "feature" of applying Gain and Offset be reverted until this bug is fix. As it stands QGIS is completely unusable if you store floating point images as Int16 to save space (a very common thing to do for storing indices such as NDVI). We have had to peg our QGIS at 2.2.

#4 Updated by Giovanni Manghi over 9 years ago

Matthew Hanson wrote:

I would like to request that the "feature" of applying Gain and Offset be reverted until this bug is fix. As it stands QGIS is completely unusable if you store floating point images as Int16 to save space (a very common thing to do for storing indices such as NDVI). We have had to peg our QGIS at 2.2.

I'm not sure I completely understand the issue, anyway I suggest you to raise the problem in the developers mailing list, where there is a much larger "audience".

#5 Updated by Nyall Dawson about 9 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF