English

How To: Round floating-point raster values in Spatial Analyst

Summary

Floating-point rasters usually have decimal values for each cell. These numbers can be rounded, and the output converted to an integer grid. The output will still be a continuous grid, not a discrete or classified grid. So if the output is converted to features, there will be a large number of features with different whole number values.

Procedure

In this document G1 is the starting grid of floating-point values and G2 is the output integer grid.

  1. Set the Analysis Environment from the Spatial Analyst menu > Options.

    Note:
    Make sure the directories in the path to the working directory have no spaces or more than eight characters in the name.

  2. Open the Raster Calculator from the Spatial Analyst menu.
  3. Insert the following expression in the Raster Calculator. Substitute the grid name for G1.

    Code:
    G2 = INT(CON([G1] > 0,CON(ABS([G1] - INT([G1])) >= 0.5,CEIL([G1]),FLOOR([G1])),CON(ABS([G1] - INT([G1])) >= 0.5,FLOOR([G1]),CEIL([G1]))))

  4. If necessary, make the output permanent by right clicking the layer and selecting the Make Permanent option, or just save the map document.