Intersect

This tool can be used to isolate all of the features, or parts of features, in two input vectors that overlap. Intersect is the vector equivalent to the Boolean operator AND used for raster overlay.

See Also:

Scripting:

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

wd = pluginHost.getWorkingDirectory()
# You may have multiple input shapefiles but they must
# be separated by semicolons in the string.
inputFiles = wd + "input1.shp" + ";" + wd + "input2.shp" + ";" + wd + "input3.shp"
outputFile = wd + "tmp1.shp"
args = [inputFiles, outputFile]
pluginHost.runPlugin("Intersect", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
// You may have multiple input shapefiles but they must
// be separated by semicolons in the string.
def inputFiles = wd + "input1.shp" + ";" + wd + "input2.shp + ";" + wd + "input3.shp""
def outputFile = wd + "tmp1.shp"
String[] args = [inputFiles, outputFile]
pluginHost.runPlugin("Intersect", args, false)

Credits: