Bug report #21023

Truncated decimals in raster data set pixel size

Added by Nicolas Cadieux over 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:Alexander Bruy
Category:Rasters
Affected QGIS version:3.4.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:28842

Description

Reported data set pixel Size (Layer property -> Information -> Pixel Size) are truncated to 9 decimals. When this information is copied in order to create a new raster, it results in a significant shift in the raster for VERY large data sets (up to 30m on the right side of my data set). I imagine that this information is derived from GDAL's geotransform components which is stored as a IEEE-754 64bit number as confirm to me by Even Rouault. Pixel size should be reported with 19 decimal significant figures ('%.19g' C formatting) to keep the original precision of a IEEE-754 64bit number. Layer extent should also be reported using the original decimal number if it is not already the case.

In python, this would be the equivalent of using this: xPixelSize= str(Decimal(geotransform1).quantize(Decimal("1.0000000000000000000"))) instead of
xPixelSize= str(geotransform1)

Associated revisions

Revision 3c2a20a9
Added by Alexander Bruy about 5 years ago

show pixel size in the raster layer properties with 19 significant
digits (fix #21023)

Revision c05c2c71
Added by Alexander Bruy about 5 years ago

show pixel size in the raster layer properties with 19 significant
digits (fix #21023)

(cherry picked from commit 3c2a20a9484cbe3f1117a692757e552e88e6195c)

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Easy fix? changed from Yes to No
  • Category changed from GUI to Rasters

#2 Updated by Alexander Bruy about 5 years ago

  • Operating System deleted (Windows 10_64)
  • Pull Request or Patch supplied changed from No to Yes
  • Assignee set to Alexander Bruy
  • Status changed from Open to In Progress

#3 Updated by Alexander Bruy about 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#4 Updated by Alexander Bruy about 5 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF