Hi Nyall,

My data is originally coming from an ESRI ascii grid. It had been many hundred 
tiles of ascii grids which I merged into a single big GEOTIFF file. The 
original data had up to 3 digits after the decimal point for the terrain height 
(mm accuracy) per cell. After import to the Geotiff the data has now many more 
(useless) digits after the comma, because the number of the digits in the 
geotiff is now defined by the float32 data type I chose. When I export that 
data back to ESRI ascii grid I get 15! digits after the decimal point. I would 
like to round it back to 2 digits after the decimal point (cm accuracy).
I might be missing something, but it sounds like this change in
precision has happened at the conversion to geotiff stage, not the
"clip raster by extent" stage?

I would assume the same. The useless (excess) prescision change happened when converting the asc files to GeoTIFF files. But is there a way to define a "precision" when creating a GeoTIFF other than choosing between Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, CInt16, CInt32, CFloat32 and CFloat64 ?

So if I want to store a meter-based terrain model with 2 digits after the decimal point I would have to choose Float32 which already results in a large number of digits behind the decimal point (useless ones, usually).

So really I need to use the DECIMAL_PRECISION creation option (co) when exporting the asc ESRI Ascii-Grid file. This was proposed by Luke Pinnter in cc and works very well.

Perhaps for the future, it could be an idea to store some DECIMAL_PRECISION meta-information in the header of the Geotiff file. Then the various tools that work on rasters in QGIS could know that they should never ever output more digits after the decimal point than what was defined with this parameter - This parameter could be used in all raster operations we do in QGIS (e.g. when querying raster values, when exporting data, zonal statistics, etc.)

Does that sound like a useful way forward to store such a meta-information parameter in the header of the GeoTIFF files in a future version of QGIS? If there is a "standard" way for setting a precision parameter in GeoTIFF files, we should use that, if not, we can invent something aligned with the "GDAL" way of doing things, such as the "DECIMAL_PRECISION" parameter.

Thanks and greetings,

Andreas

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to