0

I am attempting to add a feature class ("dis.shp") into an empty feature class("fc.shp") in a geodatabase using Python script. I have had success with the code below. However, I also would like to add values from dis.shp's field "GRIDCODE" into fc.shp's field "Classes". I have been playing around with append but am not having any luck. Any suggestions?

arcpy.Append_management(dis, fc , schemaType, fieldMappings, subtype)
3
  • Would an arcpy cursor, like an Update Cursor do what you want?
    – jbosq
    Jul 27, 2015 at 19:14
  • simple data loader i think would be easiest way to do this. append in test mode may work, in no test it will keep the schema of the data set being appended to.
    – ed.hank
    Jul 27, 2015 at 19:16
  • fc.shp is a bad name for something in FGDB
    – FelixIP
    Jul 28, 2015 at 4:06

1 Answer 1

1

I believe with the append tool both source and destination table schemas have to be the same (field names/types). Here are some options:

  1. Use the Merge tool, select features, and field calculate (not recommended since you have to be careful what you have selected before calculating)
  2. Make sure the table schemas are the same between source and destination tables and use append tool
  3. Convert destination shp to gdb fc, right click on the destination fc and select Data>Load and manually set the fields between source and destination tables and import
  4. Alternatively, you could use a combination of embedded search and insert cursors to iterate through source and insert into destination (careful of the field mapping here too)

Your Answer

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

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