AnsweredAssumed Answered

Exporting individual polygons into their own FC

Question asked by Caleb1987 on Aug 29, 2012
Latest reply on Aug 30, 2012 by Caleb1987
I have a FC that contains 53 polygons.  I needed to get these each into another geodatabase in which each individual polygon in the master FC is its own FC in the other geodatabase. I am wondering if anyone knows of another method to do this in an easier (or more logical) way?  I will have to do this again with a few other files.

Here are the steps that I was thinking:
1. Make a feature layer for the original polygon file with a query (ID = x)
2. set up a loop where I have a counter to match ID for the query
3. Copy selected features into the geodatabase
4. Move on to next polygon with the counter and repeat till loop is finished

The script I wrote doing these steps works fine, but it is really slow. 

####  Exports all polygons in FC into individual FCs in different location import arcpy, os, sys, traceback  arcpy.env.workspace = 'G:\\PROJECTS\\Cedar\\Environmental\\FEMA\\Results\\lidar.gdb' arcpy.env.overwriteOutput = True  outpath = 'G:\\PROJECTS\\Cedar\\Environmental\\FEMA\\Results\\Processing.gdb' floodbuff = '\\FloodplainAE_1000ft' flyr = 'Stream_Reach'  try:      arcpy.MakeFeatureLayer_management(floodbuff, flyr)     result = arcpy.GetCount_management(flyr)      print result     print 'Exporting polygon features into their own fc'      fid = 1     while fid <= result:                  query = '"ID" = ' + str(fid)         arcpy.SelectLayerByAttribute_management(flyr, 'NEW_SELECTION', query)          # Copy selected polygon into its own FC         arcpy.CopyFeatures_management(flyr, outpath + os.sep + flyr + str(fid))          fid += 1      print 'All polygons exported successfully'      except:      arcpy.AddError(arcpy.GetMessages(2)) 

I feel like there has to be an easier way to do this, or one that will cut down on processing time (it took about 10 minutes for 53 features with only a few attributes).  Anyone have any ideas?