This tool can be used to convert a vector file containing multi-part features into a vector containing only single-part features. Any multi-part polygons or lines within the input vector file will be split into seperate features in the output file, each possessing their own entry in the associated attribute file. For polygon-type vectors, the user may optionally choose to exclude hole-parts from being separated from their containing polygons, which is the default behaviour.
To better understand the difference between multi-part and single-part vectors consider the following. The image below shows a vector coverage of Canada in which data are stored as a single record in a multi-part polygon. The attribute table only contains one entry.
In comparison, the following vector stores features as many individual single-part polygons. Each polygon is a seperate feature that possesses its own record in the attribute table.
The following is an example of a Python script that uses this tool:
wd = pluginHost.getWorkingDirectory()
inputFile = wd + "polygons.shp"
outputFile = wd + "output.shp"
separateHoles = "true"
args = [inputFile, outputFile, separateHoles]
pluginHost.runPlugin("MultipartsToSingleparts", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "lines.shp"
def outputFile = wd + "output.shp"
String[] args = [inputFile, outputFile]
pluginHost.runPlugin("MultipartsToSingleparts", args, false)