How to cookie-cut an raster file with an polygon?

4604
13
10-30-2015 10:48 AM
NicolinaLindblad
New Contributor

I need to cut out the shapes of some lakes in my raster layer, I have the lakes both as polygons and raster. This would really help! Thank you! Using ArcMap 10.3

0 Kudos
13 Replies
DarrenWiens2
MVP Honored Contributor

There are many ways to do this:

1.) Extract by Mask​ using either raster or polygon

2.) Clip via Image Analysis Window​ using polygon

3.) Con using raster

0 Kudos
NicolinaLindblad
New Contributor

Sorry, I might have been unclear, I would like to remove the areas of the lakes from my rater layer! So the opposite result from "extract mask". You don't happen to know?

0 Kudos
DarrenWiens2
MVP Honored Contributor

Use Con.

Con(IsNull("LakesRaster"),"YourOtherRaster")

edit: ...or SetNull

edit: ...or this extremely convoluted method

0 Kudos
BenLeslie1
Occasional Contributor III

This "extremely convoluted method" is not a bad way to try if you're new to Arc.

Basically you need to create a layer that is the inverse of your lakes polygons.

You can do this by drawing a polygon layer that covers entirely your raster - then use the Union tool to union this polygon with your lakes polygon - then delete the lakes from the resulting layer.

Next use the tool search and search for "clip raster" and choose Clip (Data Management).  Use the result of the Union tool as the Output Extent and ensure the Maintain Clipping Extent option is ticked.

0 Kudos
NicolinaLindblad
New Contributor

Thank you! So if my raster with the lakes that i want to remove are called "Lakes" and my other raster layer is called "Uganda". How would the "Set Null" function be written then, I am very new to GIS, so appreciate all the help!

0 Kudos
DanPatterson_Retired
MVP Emeritus

read the link carefully, this is the simplest because you have your lakes layer so you lakes have some value, hopefully other than 0, so wherever the lake is "true" (ie it has a value) then it assign a value of no data to the output layer, hence moving your unganda data into the output and leaving no data cells where the lakes once were.

Should this not be to your liking, then I can give examples involving the Con for conditional operations, or Plus with conditions etc.  The trick is to make it simple...you need nodata (i assume otherwise you would have specified) where the lakes once were..  good luck

Without an expression

The image below uses an input raster (InRas1) as the condition. When the value for a cell on InRas1 is true (not 0 or NoData), NoData is assigned to that cell location; otherwise, the value in InRas2 is written as the output value.

0 Kudos
DarrenWiens2
MVP Honored Contributor

I think it is like:

SetNull(if this condition is false, use these cell values)

...so:

SetNull("Lakes","YourOtherRaster")

0 Kudos
DanPatterson_Retired
MVP Emeritus

just like in the help files, no helping too much

0 Kudos