How to copy data from one featureclass to another one using Python code?

04-22-2013 09:27 PM
Occasional Contributor II

I am new to Python but not new to ArcObject & .Net development. I just have a simple question that need some care from the Python developers if possible.

I have two featureclasses loaded in ArcMap and each one of them has different fields names and different count of fields.

What I need is to copy data from the 1st FC to the 2nd FC and allow the user to select fields from the 1st FC and map them with the corresponding fields in the 2nd FC and this is all using Python on ArcMap10.1.

Please support me in this case ASAP.

Thanks in advance...
Tags (2)
0 Kudos
1 Reply
Esri Esteemed Contributor
You can do this using the Append tool.  Here is an example:

arcpy.Append_management("C:/Temp/Python/Test.gdb/Centerlines", "C:/Temp/Python/Test.gdb/Streets", "NO_TEST", """NAME, #, #, C:/Temp/Python/Test.gdb/Centerlines, StreetName;\
    Address, #, #, C:/Temp/Python/Test.gdb/Centerlines, Addr""")

In the above example, the field "NAME" in the Streets feature class is being populated by the field "StreetName" from the Centerlines feature class.  Also, "Address" is being populated by "Addr".
0 Kudos