[Qgis-user] precision Identify Features tool

Even Rouault even.rouault at spatialys.com
Wed Apr 13 11:19:44 PDT 2016


Le mercredi 13 avril 2016 20:05:27, Paulo van Breugel a écrit :
> I just opened a raster layer (asci layer), with real numbers with 6
> decimals.
> 
> When click with the 'Identify Features' tool on a raster cell it shows many
> more decimals, e.g., 83.32058715820312 for a raster cell that has value
> 83.320587 (as can be easily checked by opening the layer as text file).
> 
> Any idea what I am missing here?

The raster is probably recognized as a Float32 raster (or is exposed as 
Float64), but the Identify tool  displays with the precision of a 64-bit 
floating point number. And due to how floating point computation works, the 
extension from 32 to 64 bit is done with working with the IEEE-754 binary 
representation and not the decimal representation, hence 83.320587f gets 
converted as 83.32058715820312.

For example with Python :
print struct.unpack('f', struct.pack('f', 83.320587))
(83.32058715820312,)

If the raster is exposed as a Float32 (which is likely if it is recognized by 
the AAIGRID driver : http://gdal.org/frmt_various.html#AAIGrid ), then the 
Identify tool could be improved to respect this precision.

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the Qgis-user mailing list