Isolate vector features by location

This tool can be used to either isolate or remove vector features from a shapefile based on their spatial relationship with the features in a second vector data set. The user must first specify whether polygon features in the input image are being isolated or removed. The user must then specify the spatial relation between the input features of the two vectors, with options of 1) 'intersect', 2) 'does not intersect' , 3) 'are completely within', 4) 'contains', 5) 'does not contain', 6) 'covers', 7) 'are covered by', 8) 'crosses', 9) 'touches', 10) 'does not touch', and 11) 'are within a distance of'. If the 'are within a distance of' relation is selected, the user must also specify the distance threshold.

This is the vector equivalent of the Isolate Raster Features By Location tool, which operates with input raster 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.shp"
that = "intersect"
thisFile2 = wd + "input2.shp"
output = wd + "output.shp"
dist = "not specified"
args = [wantTo, thisFile1, that, thisFile2, output, dist]
pluginHost.runPlugin("IsolateVectorFeaturesByLocation", args, False)

This is a Groovy script also using this tool:

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

Credits: