Polygons to polygon conversion with attribute name

1) I have a polygon shapefile with 1000 multi-part polygons in it. Each Row of the table is a multipart polygon.

2) I need 1000 shapefiles with 1 multi-part polygon in each.

3) Each output shapefile with 1 multi-part polygon needs to be named with a name from the attribute table (1) unique to each input polygon.

Open to ArcGIS, ArcPy, Model Builder, OGR, QGIS solutions.

# import libraries import arcpy, os # path to file polyFC = r'C:junk
aaRAA_20140522.shp' # field name to use for file names fieldName = "FID" # set overwrite environment arcpy.env.overwriteOutput = True # loop through features for row in arcpy.da.SearchCursor(polyFC, ["[email protected]", fieldName]): # make new filename based on field value newName = os.path.join(os.path.dirname(polyFC), str(row[1]) + ".shp") # copy features to new file arcpy.CopyFeatures_management(row[0], newName)

I would suggest using arcpy. Here is the general proposed code flow:

  1. Make feature layer of layer of interest
  2. Use search cursor on feature layer to get attribute of ID field and attribute of field for new shp name
  3. Use select by attribute method for each ID attribute for each row (i.e. unique feature)
  4. Create new feature class on selected feature layer using feature class to feature class method and reference value from name field for new shp name

I went the model builder route.

This seemed to work.

The input shapefile is A I then iterated through Features while setting the %Value% As the attribute.

Then used FC to FC tool with the output name as %Value%.shp

Phoelm ArcPy (alternate comment and answer) worked on 90% of the files but see the comment for a strange error on a few of them.

Watch the video: ZBrush tutorial on using ZRemesher and UV Master (October 2021).