# How do you use SetNull to set a range of values to a single value in a raster?

7751
3
01-14-2015 07:20 AM
Occasional Contributor

I open Raster Calculator and run this:

SetNull("worldelvtn1ft.tif",1,"VALUE > 0") – sets everything less than 0 to 1

However, what I would like to do is set all the values from 0 to 50 as 1. i'm hoping there is  a simple way of using the < > symbols but i can't figure out the right combination to make it work.

Also instead of setting it to 1 how do you set it to no data? The help on SetNull is vague and I really can't find a large list of examples.

Thanks!

Tags (3)
1 Solution

Accepted Solutions
MVP Frequent Contributor

I think "Con" might be a better way to go than "SetNull" for what you are trying to do.

You can run Con as a tool or in Raster Calculator.

Con can also be used like SetNull:

If no input false raster or constant is specified, NoData will be assigned to those cells that do not result in True from the expression.

Con (Spatial Analyst)

ArcGIS Help 10.1

Chris Donohue, GISP

3 Replies
MVP Frequent Contributor

I think "Con" might be a better way to go than "SetNull" for what you are trying to do.

You can run Con as a tool or in Raster Calculator.

Con can also be used like SetNull:

If no input false raster or constant is specified, NoData will be assigned to those cells that do not result in True from the expression.

Con (Spatial Analyst)

ArcGIS Help 10.1

Chris Donohue, GISP

Occasional Contributor

Chris,

I was able to set the range by using the following expression in Raster Calculator.

Con(("TargetRaster" < 0) & ("TargetRaster">-100),1)

This set everything from -100 to 0 as 1 and the rest of the raster was set to Null (No Data).

Dan

MVP Frequent Contributor