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

7140
3
Jump to solution
01-14-2015 07:20 AM
DanielAmrine
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!

0 Kudos
1 Solution

Accepted Solutions
ChrisDonohue__GISP
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

View solution in original post

3 Replies
ChrisDonohue__GISP
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

DanielAmrine
Occasional Contributor

Chris,

thank you for your reply! Con did work better.

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

0 Kudos
ChrisDonohue__GISP
MVP Frequent Contributor

Glad to be of help.

Chris Donohue, GISP

0 Kudos