[GIS] combine raster with another raster mask file – gdal

cclipgdalmaskingraster

I have 2 rasters in GeoTiff format. One has all of the land and water and the other is a mask file that shows either 0 for water or 1 for land. I basically want my output to just have the land values and all the areas that were water in the first image to just be 0,0,0. Is there a way to do this with any of the gdal command line tools?

Basically I want to do what gdal_rasterize does with a shp file mask but with a raster instead.

Best Answer

You may want to check gdal_translate (see http://www.gdal.org/gdal_translate.html) in which you can define a mask band. But first, you'll have to stack your two raster in a multiband image.