Multipart To Singlepart (Data Management)

Summary

Creates a feature class of singlepart features by separating multipart input features.

Illustration

Multipart to Singlepart tool illustration

Usage

  • The attributes of the input features will be maintained in the output feature class. A new field, ORIG_FID, will be added to the output feature class and set to the input feature IDs.

  • Each part of a multipart feature will be separated into individual features in the output feature class. Features that are already singlepart will not be affected.

  • Most of the output feature types will be the same as input (input polygons remain polygons; input lines remain lines). If the input features are of type multipoint, the output feature class will be type point.

  • To reconstruct multipart features from singlepart features based on a common field value, such as ORIG_FID, use the Dissolve tool.

  • A multipatch feature will be separated into its constituent geometry parts. Each part can be defined by a collection of vertices containing x-, y-, and z-coordinates that are arranged as follows:

    • Individual triangles that reference three vertices.
    • Triangle strips that are defined by multiple triangles that successively share one common edge.
    • Triangle fans that are defined by multiple triangles with a common point of origin.
    • Rings that represent a coplanar region whose boundary is defined by four or more vertices.

Parameters

LabelExplanationData Type
Input Features

The input features that can be any feature type.

Feature Layer
Output Feature Class

The output feature class containing features that vary by input feature type.

Feature Class

arcpy.management.MultipartToSinglepart(in_features, out_feature_class)
NameExplanationData Type
in_features

The input features that can be any feature type.

Feature Layer
out_feature_class

The output feature class containing features that vary by input feature type.

Feature Class

Code sample

MultipartToSinglepart example 1 (Python window)

The following Python window script demonstrates how to use the MultipartToSinglepart function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.management.MultipartToSinglepart("landuse.shp",
                                       "c:/output/output.gdb/landuse_singlepart")
MultipartToSinglepart example 2 (stand-alone script)

The following stand-alone script is a simple example of how to apply the MultipartToSinglepart function in a scripting environment.

# Name: MultipartToSinglepart_Example2.py
# Description: Break all multipart features into singlepart features,
#              and report which features were separated.

# Import system modules
import arcpy
 
# Create variables for the input and output feature classes
inFeatureClass = "c:/data/gdb.gdb/vegetation"
outFeatureClass = "c:/data/gdb.gdb/vegetation_singlepart"

try:
    # Create list of all fields in inFeatureClass
    fieldNameList = [field.name for field in arcpy.ListFields(inFeatureClass)]

    # Add a field to the input that will be used as a unique identifier
    arcpy.management.AddField(inFeatureClass, "tmpUID", "double")
 
    # Determine what the name of the Object ID is 
    OIDFieldName = arcpy.Describe(inFeatureClass).OIDFieldName
   
    # Calculate the tmpUID to the OID
    arcpy.management.CalculateField(inFeatureClass, "tmpUID",
                                    f"!{OIDFieldName}!", "PYTHON3")
 
    # Run the tool to create a new fc with only singlepart features
    arcpy.management.MultipartToSinglepart(inFeatureClass, outFeatureClass)
 
    # Check if there is a different number of features in the output
    #   than there was in the input
    inCount = int(arcpy.management.GetCount(inFeatureClass)[0])
    outCount = int(arcpy.management.GetCount(outFeatureClass)[0])
    
    if inCount != outCount:
        # If there is a difference, print the FID of the input 
        #   features that were multipart
        arcpy.analysis.Frequency(outFeatureClass,
                                 outFeatureClass + "_freq", "tmpUID")
 
        # Use a search cursor to go through the table, and print the tmpUID 
        print("Multipart features from {0}".format(inFeatureClass))
        for row in arcpy.da.SearchCursor(outFeatureClass + "_freq",
                                         ["tmpUID"], "FREQUENCY > 1"):
            print(int(row[0]))
    else:
        print("No multipart features were found")

except arcpy.ExecuteError:
    print(arcpy.GetMessages())
except Exception as err:
    print(err.args[0])

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics