3

How do I use raster calculator so that the new raster only shows multiples of 128?

I'm not sure what the expression should be.

  • It might be useful to understand the purpose. What is the input? – jbchurchill May 12 '16 at 12:56
5

Something like this would do the trick:

Con(Con(**input_raster**,Mod(**input_raster**,128))==0,**input_raster**)

Let's break this apart:

The inner Con statement takes your input raster as a conditional raster and returns its modulus against test value (in this case 128). The Mod function returns zero where the number is divisible by your test value, If not it returns the original value. Be careful with this.

The outer Con statement takes the result from the inner Con and checks if it is equal to zero, then returns the original values (multiples of 128) if true.

Example:

Input Raster enter image description here

Inner Con Results - Note how values not divisible by 128 are treated. enter image description here

Outer Con Results enter image description here

  • 1
    (+1) The two uses of con are redundant. In fact, an alternative might be better. SetNull(Mod(**input**, 128)!=0, **input**) may be closer to what was desired. – whuber May 12 '16 at 16:39

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.