8

I have a float type raster file (an NDVI made from ERDAS IMAGINE) and would like to convert it to an interger type raster file in order to use Focal Statistics function (Majority). Is there any way to do this?

  • 1
    Could you please supply more details on the raster? For example, how many bands? What information does the raster contain (e.g. elevation DEM)? – Aaron Oct 7 '14 at 2:35
12

Menno's answer will work but it will work but it will always round down. For example, 99.99999 becomes 99.

This function in the raster calculator or map algebra tool will do logical rounding.

Int(yourraster + 0.5).

This way 99.99999 becomes 100 and and 99.49999 becomes 99.

  • That's true, I should have mentioned that. – Menno Oct 7 '14 at 13:25
  • 1
    It is still a solid answer. I often use INT as sometimes it just does not matter. – If you do not know- just GIS Oct 7 '14 at 13:46
  • 1
    Thank you user two seven two three nine for this detailed information. – Gloria Oct 8 '14 at 3:51
  • @Gloria Remember to accept an answer if it answered your question. – If you do not know- just GIS May 17 '17 at 15:09
4

From the fact that you plan to use focal statistics I infer that you must be able to use the spatial analyst extension.

In the spatial analyst toolbox there is a tool Int in the Math toolset which converts a floating point raster to an integer raster.

1

You need to stretch the NDVI floating point values (-1 to 1) to 8-bit unsigned (0 - 255). If you convert the float to integer directly, the resulting raster will have only one integer value. You can stretch the values in the Raster Calculator using the following equation:

(NDVI - -1) * 255 / (1 - -1) + 0
0

I use raster calculator all the time for mapping riverine floodplains.

I found that when I turned a raster set into an integer raster set by using Int () in the raster calculator that I lost information.

In order to avoid the likelihood of this happening, I would advise to use Con () instead to convert all values to a single integer value of your choosing and then converting that product to a polygon using raster to polygon conversion.

  • I believe that Focal Statistics only works on an int() type raster. Is there a similar tool for con() types? – MaryBeth Nov 5 '15 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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