Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using ArcGIS 10.1.

I am searching for a solution to calculate a raster. The values are like: 0.2 0.6 5.3 i.e. How can I now get 0.2 as 0 and 0.6 to 1 and 5.3 to 5? In the end integer numbers. The "roundup" and "rounddown" functions are worse to do this.

Thanks for any hints.

Luigi

share|improve this question

3 Answers 3

up vote 6 down vote accepted

Int(yourraster + 0.5) will round to the nearest integer.

share|improve this answer
    
Thanks. That is want I looked for. –  luigi Apr 29 '13 at 15:00

If you have multiple values to reclassify from a single raster then I suggest to use "arcpy.sa.Reclassify" tool. For example:

outras = arcpy.sa.Reclassify(inras,"Value",RemapValue([0.2,0],[0.6,1],[5.3,5]),"DATA")
share|improve this answer
    
Although this method is very flexible, it is much harder, more error-prone, and more time-consuming than Luke's answer. –  whuber Apr 29 '13 at 14:44
    
Not my solution. ;-) –  luigi Apr 29 '13 at 15:01

I know this might be late but does int(yourraster + 0.5) really give the result? I think what it does is that it simply strips the decimal place (rounding down always). So if you use int(5.9) it will simply return 5 as the result. But shouldn't a round function yield 6 as result? In Python, the function int(round(5.9,0)) will yield 5 as a result, but not sure how this is achieved within the raster calculator of ArcGIS.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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