[GIS] Apply water mask to a raster layer

arcgis-desktopmaskingrastervector

I have a vector polygon layer which represents water bodies and I have a raster layer (250m pixel NDVI values). What I need is to mask all pixels in a raster layer that intersect my water mask and turn them into NoData.

Since I want to do it in ArcMap, there seems to be a bunch of tools like set null and con, but they work only with raster data. On the other hand, extract by mask does the opposite to what I need: it masks everything BUT the mask.

So my question is: is there a (best) way to apply a vector mask to a raster layer in ArcMap? And if no – how do I do it through rasterizing vector data, taking into account the resolution of the target layer?

Best Answer

I am assuming you have access to the spatial analyst extension license.

You can rasterize your polygons with Polygon to Raster, use OID/FID as value field but it doesn't matter what field you use as long as it is numeric, but before you do set your environments cell size, output extent and snap raster to your existing NDVI raster. Your polygon raster will now have the same extent and cell size as your existing NDVI raster and cell boundaries will align.

Using Con with an IsNull statement on the polygon raster set where IsNull is True to NDVI and a constant, -29999 would work, where False. With SetRasterProperties set the NoData value of the output raster to -29999.