raster_tools.clipping.mask#

raster_tools.clipping.mask(feature, data_raster, invert=False)[source]#

Mask the data raster using the given feature.

Depending on invert, the area inside (True) or outside (False) the feature is masked out. The default is to mask the area outside of the feature.

Parameters
  • feature (str, Vector) – The feature to mask with. If a string, this is interpreted as a path.

  • data_raster (str, Raster) – The data raster to be erased. If a string, this is interpreted as a path.

  • invert (bool, optional) – If True, the mask is inverted and the area inside of the feature is set to masked out. Default False.

Returns

The resulting masked raster with the same dimensions as the original data raster.

Return type

Raster