Select to view content in your preferred language

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

404
3
09-09-2015 11:17 AM
Status: Implemented
Labels (1)
AJR
by
Frequent Contributor

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.

3 Comments
CindyWilliams1
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.
AJR
by

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.

HannesZiegler
Status changed to: Implemented

Thank you for your submission, and apologies for the very late response. Your post was only recently redirected to the correct ideas exchange for Python/ArcPy ideas.

It turns out we have implemented AddFields (multiple) some time ago, and it is intended to fill the gap discussed here. While it is not exactly as requested, using CreateFeatureClass and AddFields together provides the ability to generate new FeatureClasses on-the-fly, or add additional fields to an existing FeatureClass. For this reason, we are closing this idea now as implemented.