0

I am attempting to multiply my raster values by 10000 using the raster calculator in QGIS 3.6.2. But am getting weird results. For example I have an initial raster value of 30303 and would expect a return of 303030000 but instead get a return of 303030016. However the initial value of 10101 gives me the expected 101010000 but 101010 gives me 1010099968 and 121212 gives me 1212120064.

The formula is simply ras@1 * 10000

Is there something I am doing wrong? I assume this is some kind of rounding issue.

6
  • 1
    you might be exceeding the storage capacity of the raster format
    – csk
    Jun 25, 2019 at 19:20
  • I was wondering if that was the case. I just tried and x100 works. The raster is in float 32 which I assumed would have enough room.
    – Baswein
    Jun 25, 2019 at 19:55
  • float64 doesn't work either
    – Baswein
    Jun 25, 2019 at 20:05
  • I wonder if it might be possible to achieve your end goal another way, without converting the base data. What are you trying to achieve?
    – csk
    Jun 25, 2019 at 20:14
  • Sure - I have 5 rasters that represent landuse at different times. I am trying to create a unique value for each land use history. 303030303 has been forest the entire time 1212121212 has been residential. What is nice about this is that it is relatively transparent if you understand the system when changes are happening.
    – Baswein
    Jun 25, 2019 at 20:20

1 Answer 1

1

It appears that I was reaching the limit of the float 32 file size as @csk suggested. By using the GDAL Raster Calculator instead of the QGIS native one I was able to tell it to produce a float 64 file instead. (originally I changed the input file to float 64 but it seems that the QGIS Raster Calculator defaults to float 32)

Luckily my numbers made it easy to realize that this was happening I could see many instances where this would not be so obvious.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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