GeoEco.DataManagement.ArcGISRasters.ArcGISRaster.FindAndExtractByMask
- classmethod ArcGISRaster.FindAndExtractByMask(inputWorkspace, outputWorkspace, mask, wildcard='*', searchTree=False, rasterType=None, outputRasterPythonExpression='os.path.join(outputWorkspace, inputRaster[len(workspaceToSearch)+1:])', modulesToImport=['os.path'], skipExisting=False, overwriteExisting=False)
Finds rasters in an ArcGIS workspace and extracts the cells that correspond to the areas defined by a mask.
This function just calls the ArcGIS Spatial Analyst’s
ExtractbyMask()tool with the extraction_area set toINSIDE. This function only exists so that we can easily create a batched version of that tool.- Parameters:
inputWorkspace (
str) – Workspace to search. Minimum length꞉ 1. Must exist.outputWorkspace (
str) – Workspace to receive the output rasters. Minimum length꞉ 1.mask (
str) – Input mask data defining areas to extract. This can be a raster or feature dataset. When it is is a raster, NoData cells on it will be assigned NoData values on the output raster. Minimum length꞉ 1. Must exist.wildcard (
str, optional) – Wildcard expression specifying the rasters to find. Please see the documentation for the ArcGISListRasters()function for more information about the syntax. At the time of this writing, only the*wildcard character was supported, which would match zero or more of any character. Minimum length꞉ 1.searchTree (
bool, optional) – If True, child workspaces will be searched.rasterType (
str, optional) – Type of rasters to find. If provided, only rasters of this type will be found. At the time of this writing, the ArcGIS Pro 3.2 documentation specified that any of the following strings would be accepted:All(the default),BMP,GIF,GRID,IMG,JP2,JPG,PNG,TIFF. Minimum length꞉ 1.outputRasterPythonExpression (
str, optional) –Python expression used to calculate the absolute path of an output raster. The expression may be any Python statement appropriate for passing to the eval function and must return a string. The expression may reference the following variables:
workspaceToSearch- the value provided for the workspace to search parameteroutputWorkspace- the value provided for the output workspace parameterinputRaster- the absolute path to the input raster
The default expression,
os.path.join(outputWorkspace, inputRaster[len(workspaceToSearch)+1:]), stores the output rasters in the output workspace at the same relative location as the input rasters appear in the workspace to search. The output raster path is calculated by stripping the workspace to search from the input raster path and replacing it with the output workspace.For more information on Python syntax, please see the Python documentation.
Minimum length꞉ 1.
modulesToImport (
listofstr, optional) – Python modules to import prior to evaluating the expression. If you need to access Python functions or classes that are provided by a module rather than being built-in to the interpreter, list the module here. For example, to be able to use thedatetimeclass in your expression, list thedatetimemodule here. In your expression, you must refer to the class using its fully-qualified name,datetime.datetime.skipExisting (
bool, optional) – If True, processing will be skipped for output rasters that already exist.overwriteExisting (
bool, optional) – If True and skipExisting is False, existing output rasters will be overwritten.
- Returns:
Workspace to receive the output rasters.
- Return type: