I am using Normalize difference vegetation index (NDVI) derived from the landsat satellite band 3 and band 4 that have float values ranges from -1.0 to 1.0. I want to see the attribute table that is not possible in QGIS. I tried following expression in raster calculator of qgis but it did not work:

Int("float_raster" * 100)

the reason to multiply with 100 is to preserved the 2 digits at right level in attribute table that can be seen by again dividing by 100 in attribute table.

How can i scale see the better contrast in colour palette using qgis 2.40

  • How exactly did this raster calculation "not work"?
    – whuber
    Feb 10, 2015 at 21:37
  • 1
    @whuber. It executed successfully and added in TOC but I can not open the attribute table even. Only shift of 2 digits to left can be seen in the raster but not truncated (rounded) that should be in integer value conversion as does in arcGIS raster calculator.
    – Waseem Ali
    Feb 10, 2015 at 21:46
  • Can you not then use Translate (GDAL_Translate) with an output type of 16 bit integer (-ot Int16) to perform the rounding of the results? Feb 10, 2015 at 22:40
  • @MichaelMiles-Stimson. Can you please little bit explain how can i do it if this is the solution to cope with the problem. I do not know how to translate ...
    – Waseem Ali
    Feb 11, 2015 at 12:39
  • I didn't know you could get an attribute table with rasters in QGIS. I'm also unclear on how converting from a float to a integer will resolve this problem. QGIS is more than capable of displaying Float values. Try this: qgistutorials.com/en/docs/raster_mosaicing_and_clipping.html Feb 11, 2015 at 15:44

1 Answer 1


I think this has been answered here How to round pixel values of a raster in QGIS?

Basically, QGis Raster Calculator does not do float <-> int conversion. Use gdal_translate instead.

  • Or if you want to skip the step: Raster calculator -> gdal_translate, simply use gdal_cal (or the QGIS built in GDAL Raster Calculator) instead (I just added an answer on the quoted question ).
    – Honeybear
    Feb 1, 2022 at 15:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.