hi all,
OK here's what I want to do...
I have 2 Feature Classes.
One is the main Feature Class which resides in a Geodatabase which I want to update - call it "FC_main"
The other Feature Class resides in a FGDB which gets new updated metadata & new/modified objects from an export from another database - "FC_new"
Both FC's have the same schema ([fieldID], [field1], [field2], [field3], [field4], [field5]). Both have a matching unique ID field (fieldID).
Using arcpy is it possible to compare the 2 FCs, update any metadata differences, add new objects, update any changed spatial locations ?
I've been playing around with lists, search cursors ,update cursors and can do parts of this, but not all. My scripting is pretty limited.
The main problem I have are the existing objects when they have coordinate changes. These don't seem to update.
Just need to be put onto the right path and the steps to go about coding all this into 1 script.
Arc 10.2.
Many thanks,
Tim
Solved! Go to Solution.
So FC_main should be updated from FC_new? I would just wipe out the features in FC_main and then append them from the FC_new.
I would use:
Truncate Table
http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//00170000016z000000
Append
http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//001700000050000000
Typically I set the schema_type to "NO_TEST"
Metadata Importer
http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//00120000000z000000
This will insure that the FC_main is the same as FC_new without having to loop over the whole thing with a cursor. We have many update operations for our SDE that are variations on this theme. One can set the python to run every night with windows task scheduler.
Hi Tim,
Is "FC_main" in a File or SDE Geodatabase?
“FC_Main” sits in our SDE database.
thanks
So FC_main should be updated from FC_new? I would just wipe out the features in FC_main and then append them from the FC_new.
I would use:
Truncate Table
http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//00170000016z000000
Append
http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//001700000050000000
Typically I set the schema_type to "NO_TEST"
Metadata Importer
http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//00120000000z000000
This will insure that the FC_main is the same as FC_new without having to loop over the whole thing with a cursor. We have many update operations for our SDE that are variations on this theme. One can set the python to run every night with windows task scheduler.
Thanks for the reply.
Yes FC_Main will be an update from FC_New.
That was my first option – remove features, append data….but was thinking there may be a more efficient way of doing that.
I was finding after I removed all features, then append new data (8000 records) I would have to compress the database for the Feature Class to display quickly.
I had not looked at Truncate Table option so I might give this a play !
Thanks!
Tim
hi mate,
I tested this today and it works brilliantly.
Many thanks.
Nice! Happy to help.