Changing feature class type of existing feature class using python

2179
5
10-06-2018 05:25 AM
ThomasL
Occasional Contributor

I have an empty point feature class in a file geodatabase. I also need an exact copy of this in a line and polygon feature class type (in the same file geodatabase).

I am unable to identify any tools or arcpy workflows that allow me to change an existing empty feature class type.

An export to shapefile will remove all the subtypes and long field names and field alias.

I use ArcGIS Pro 2.2 - Advanced license level.

My hope was a python code with the following flow:

- Create a copy of the existing point feature class in the same file geodatabase

- Changing feature class type to line/polygon

 

Any help is greatly appreciated.

0 Kudos
5 Replies
JoeBorgione
MVP Emeritus

 also need an exact copy of this in a line and polygon feature class type (in the same file geodatabase).

 

Do you mean you need a line and polygon feature class of the same schema/attributes and spatial coordinate system as the point feature class?

Create Feature Class—Help | ArcGIS Desktop 

Use your point feature class as the 'template'

That should just about do it....
ThomasL
Occasional Contributor

Thanks Joe Borgione‌.

The "Create Feature Class Tool" unfortunately dose not transfer the subtypes to the new feature class.

Any idea how to include the subtypes too? 

0 Kudos
JoeBorgione
MVP Emeritus

Sorry, I don't.  I did a google search and nothing of value was returned...

That should just about do it....
0 Kudos
JamesMacKay3
Occasional Contributor

It seems kind of hacky, but one approach might be to do this:

 - Export the feature class to an XML workspace document (schema only)

 - Use Python to modify the XML file, specifically the geometry type and feature class name

 - Import the XML workspace document

That should maintain all of the subtypes and such.

JoeBorgione
MVP Emeritus

That sounds good to me: certainly worth a look.  Thomas; how many feature classes are you talking about?  Is this something you need to do often over time?

That should just about do it....
0 Kudos