Difference

This tool can be used to isolate the features, or parts of features, in the first input vector that do not overlap with features in a second input vector. Difference is the vector equivalent to the Boolean operator NOT used for raster overlay.

See Also:

Scripting:

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

wd = pluginHost.getWorkingDirectory()
inputFile1 = wd + "input1.shp"
inputFile2 = wd + "input2.shp"
outputFile = wd + "output.shp"
args = [inputFile1, inputFile2, outputFile]
pluginHost.runPlugin("Difference", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile1 = wd + "input1.shp"
def inputFile2 = wd + "input2.shp"
def outputFile = wd + "output.shp"
String[] args = [inputFile1, inputFile2, outputFile]
pluginHost.runPlugin("Difference", args, false)

Credits: