This question regarding ArcToolbox. I am trying to copy an empty feature class to create multiple empty feature classes with various geometries.

All I want to know is how to copy the feature class (template) so I can get just the fields and associated domain values, and no geometry type from the one that I am copying from. Instead, I want to explicitly pass the geometry type for each feature class from an input Excel file. And delete the selected fields from value list as required after copying.

I used below code but it copies and adds the fields in the empty feature classes, but it has higher time complexity and solution is not efficient when it comes to copying fields to the multiple feature classes. So I am looking for something that just copies the feature class straight away without taking the geometry into consideration.

core_fields = arcpy.GetParameterAsText(2)
feature_classes = pd.read_excel(xls)
fields = arcpy.ListFields(r"E/abc.gdb/featureclassName")

for i in range(0,len(feature_classes)):
    rvalue = feature_classes['in_table'][i]
    for field in fields:
        for c_field in core_fields:
            if c_field == str(field.name):
                 arcpy.AddField_management(rvalue,field.name, field.type, field.precision, field.scale, field.length, field.aliasName,"", field.required, field.domain)

2 Answers 2


Try the Create Feature Class tool

You can set the geometry (which you'll need to write code that reads the geometry type from the excel spreadsheet). Then you can pass in a template dataset - the fields from this featureclass are added to the empty output featureclass that gets created.

arcpy.management.CreateFeatureclass("myFileGDB.gdb", "NEW_FC", "POLYGON", "TEMPLATE_FEATURECLASS")

I think in this case longer path (create your classes first) will work better, because it is easy to create robust tool with dialog that looks like that:

enter image description here

by using options: "multivalue", "obtained from" and mighty "field value filter":

enter image description here

There is one annoying thing however, "type" property of field class, has to be converted into values that "add field" tool understands. I use this piece of code to handle this:

lookup = {'SmallInteger': 'SHORT', 'String': 'TEXT', 'Double': 'DOUBLE',
          'Single': 'FLOAT', 'Date': 'Date', 'Integer': 'LONG'}
sourceNames=[row.name.upper() for row in fldSource]
for destFC in bigList:
    dNames=[row.name.upper() for row in destFields]
    names2add=filter(lambda x: x not in dNames,fieldList)
    for name in names2add:
        theType = lookup[fld.type]
        arcpy.AddField_management (destFC,
                                   theName, theType, "", "",

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.