Allow field listing to be passed in to the CreateFeatureClass arcpy function

09-09-2015 11:17 AM
Status: Open
Occasional Contributor II

When creating feature classes dynamically using python code, it is very inefficient to have to call CreateFeatureClass and then call AddField multiple times to create the additional attribution.  The CreateFeatureClass tool should allow the passing in of a list of fields (and their data types, aliases, default value, etc.) in addition to supporting a template feature class.  The template option works great if you actually have a template to build from, but when building new feature classes on-the-fly that don't have a template, being able to pass in the field listing rather than have to call AddField multiple times would be a much better option.

I recently started using the da.NumPyArrayToFeatureClass function instead to create feature classes dynamically. That, or CreateFeatureClass in combo with da.ExtendTable() to add the fields.

Additionally, the template can/should be a table or table view, not a feature layer.  Currently even if I have a table with all the fields exactly like I want them, there isn't any way to pass that table as a template in to the createfeatureclass function.