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?

2 Answers 2


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.


As an alternative to @Michael Stimson 's method. You can create a polygon which covers your entire area as like AOI. Then clip water polygons with erase tool. After that you will have a big polygon where water bodies are holes. Finally you can use extract by mask tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.