Isolate raster features by location

This tool can be used to either isolate or remove polygon features from a raster image based on their spatial relationship with the features in a second raster data set. Raster polygon features are defined as patches of similar non-zero value. The user must first specify whether polygon features in the input image are being isolated or removed. They must then specify the spatial relationship between the input features of the two rasters, with options of 1) 'intersect', 2) 'are completely within', 3) 'are within a distance of', and 4) 'have their centroids in'. If the 'are within a distance of' relation is selected, the user must also specify the distance threshold.

This is the raster equivalent of the Isolate Vector Features By Location tool, which operates with input vector shapefiles.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
wantTo = "isolate features from"
thisFile1 = wd + "input1.dep"
that = "intersect"
thisFile2 = wd + "input2.dep"
output = wd + "output.dep"
dist = "not specified"
args = [wantTo, thisFile1, that, thisFile2, output, dist]
pluginHost.runPlugin("IsolateRasterFeaturesByLocation", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def wantTo = "isolate features from"
def thisFile1 = wd + "input1.dep"
def that = "are within a distance of"
def thisFile2 = wd + "input2.dep"
def output = wd + "output.dep"
def dist = "1000.0"
String[] args = [wantTo, thisFile1, that, thisFile2, output, dist]
pluginHost.runPlugin("IsolateRasterFeaturesByLocation", args, false)

Credits: