Cut out raster using polygon

826
2
05-20-2022 01:49 PM
Deepa
by
New Contributor III

Hi,

I would like to remove  raster values outside a polygon file. The polygon file is the county boundary. I see that i can use extract by mask or clip but then the output raster image still gets a value called Nodata outside the county boundaries. I would like the removed place (outside county area) to be completely removed from the raster image. I dont want those pixels to show Nodata value when i identify using Idenitfy tool. How can i do that?

My goal is to then convert this raster file into to a text file and then use R to do further analysis. I see there are so much nodata in the text file if i do like this and i dont want NoData in my text file. Is there some way to fix this in ArcMap itself? 

 

Thank you!

0 Kudos
2 Replies
RyanDeBruyn
Esri Contributor

@Deepa 

Sounds like you are trying to "cookie cut" a section of the raster using your county feature class boundary.

You are correct that you can use Extract By Mask . Additionally you could use Clip Raster and specify the bounding geometry.

Note that in this case the output raster is a minimum bounding rectangle of the mask (county features) by default. You can optionally control the analysis extent using the extent environment setting.

Every cell location in a raster has a value assigned to it . When information is unavailable for a cell location, the location will be assigned as NoData.   Note that NoData and 0 are not the same—0 is a valid numerical value

You can convert to ascii using the Raster to Ascii conversion tool.

Good luck

JohnWatt
Occasional Contributor

Hi Deepa.  You can think of a raster as a table with a certain number of rows and columns, so is always rectangular, even if some of the cells don't contain a value. Having lots of Nodata values might seem untidy, but they're just a product of the tabular raster data structure.  They are transparent to raster analysis so shouldn't slow things down in GIS.  Converting from Raster to Poly will solve your problem, but then you'll lose the analytical flexibility of having the layer as raster. For R, you may need to change NoData to NULL, NA, NaN or similar - part of the fun of data wrangling 🙂

0 Kudos