Multipart to Singlepart (Data Management) |
|
Release 9.3
Last modified March 8, 2012 |
![]() ![]() ![]() Print all topics in : "Tools" |
NOTE: This topic was updated for 9.3.1.
Separates (explodes) multipart features into separate single-part features
Illustration
Usage tips
Features that already have single-part geometry will not be affected.
The features in the Output Feature Class will have the same attributes as the Input Features.
The ORIG_FID field will be added to the Output Feature Class and will be set to the Input Feature's FID.
If the input is a multipoint feature class, the output will be a point feature class.
The opposite of this tool is Dissolve, which creates multipart features from single-part features based on a matching attribute value.
To determine which input features are multipart, add a field to the Input Features and calculate (using the Calculate Field tool) the values in that field equal to the OID or FID. After running the Multipart To Singlepart tool, use the Frequency tool on the output. In the resulting table, any record with a frequency greater than one is a multipart feature.
The following environment settings affect this tool: Coordinate system, Extent, XY Tolerance, Z Tolerance, M Tolerance, XY Resolution, Z Resolution, M Resolution, Output XY domain, Output Z domain, Output M domain, Output has M values, Output has Z values, Default Z value, Configuration keyword, and Output Spatial Grid.
Command line syntax
An overview of the Command Line window
MultipartToSinglepart_management <in_features> <out_feature_class>
Parameter | Explanation | Data Type |
<in_features> |
Each of the input feature's part(s) will be copied as individual features in the output feature class. If the input feature class is multipoint, the output feature class will contain points. |
Feature Layer |
<out_feature_class> |
The feature class that will contain the results. |
Feature Class |
MultipartToSinglepart c:/gdb.mdb/vegetation c:/gdb.mdb/vegetation_singlepart
Scripting syntax
About getting started with writing geoprocessing scripts
MultipartToSinglepart_management (in_features, out_feature_class)
Parameter | Explanation | Data Type |
in_features (Required) |
Each of the input feature's part(s) will be copied as individual features in the output feature class. If the input feature class is multipoint, the output feature class will contain points. |
Feature Layer |
out_feature_class (Required) |
The feature class that will contain the results. |
Feature Class |
# Purpose: Break all multipart features into singlepart features, and generate a report of which features were separated. # Create the geoprocessor import arcgisscripting gp = arcgisscripting.create() # Create variables for the input and output feature classes inFeatureClass = "c:/gdb.mdb/vegetation" outFeatureClass = "c:/gdb.mdb/vegetation_singlepart" # Use error trapping in case a problem occurs when running the tool try: # Add a field to the input (if not already present), this will be used as a unique identifier if not gp.ListFields(inFeatureClass,"tmpUID").Next(): gp.AddField(inFeatureClass, "tmpUID","double") # Determine what the name of the Object ID is fields = gp.listfields(inFeatureClass, "","oid") OidFieldName = fields.next().name # Calculate the tmpUID to the OID since this is a Personal GDB, wrap the Field inside [] exp = "[" + OidFieldName + "]" gp.CalculateField(inFeatureClass, "tmpUID", exp) # Run the tool to create a new fc with only singlepart features gp.MultipartToSinglepart(inFeatureClass,outFeatureClass) # Check if there is a different number of features in the output than there was in the input if (gp.GetCount(inFeatureClass) == (gp.GetCount(outFeatureClass))): print "The number of features in the input is the same as in the output, so no multipart features were found" else: # If there is a difference, print out the FID of the input features which were multipart gp.Frequency(outFeatureClass, outFeatureClass + "_freq", "tmpUID") # Use a search cursor to go through the table, and print the tmpUID print "Below is a list of the FIDs of all the multipart features from " + inFeatureClass rows = gp.SearchCursor(outFeatureClass + "_freq", "[FREQUENCY] > 1") row = rows.next() while row: print int(row.tmpUID) row = rows.next() except: # If an error occurred, print out the error message print "Error occurred" print gp.GetMessages()