Script To Load Shapefiles Into SDE

854
2
06-16-2011 05:46 AM
deleted-user-RjoC4IOGTpoH
New Contributor
I'm hoping someone has come across this scenario before and has a script developed that I can modify to work locally for me.

I have a bunch of shapefiles in a folder on the same server as SDE 10. I have a feature dataset setup with the feature classes named the same as each shapefile. The shapefiles in the folder get overwritten with new files every 4 hours since we are using the same names.

I need to have the shapefiles replace the feature classes at a predetermined schedule with the same names as the shapefiles. Even if it deletes all the existing feature classes within the dataset and creates them again from the shapefiles is fine. The connection to SDE is a direct connection.

If anyone can point me in the right direction it would be greatly appreciated.

Thanks in advance.

Nestor.
Tags (2)
0 Kudos
2 Replies
curtvprice
MVP Esteemed Contributor
This is a simple enough task to do in model builder -- the kind of stuff it's really good at, no user input, or error checking, just run the tools and be done with it.

Seems to me the best approach would be not to recreate the feature classes from scratch, but run the delete rows tool on each of your feature classes and then use the Append tool to copy new data into those feature classes. This would avoid having to regenerate indexes, relates, or domain settings.

If you have a model builder model that works, all the python script has to do is create a geoprocessor, add your toolbox that contains your model, and run the tool.
0 Kudos
deleted-user-RjoC4IOGTpoH
New Contributor
Thanks Curtis.

Followed your advice and with a little tweaking it works fine.

Thanks !!

Nestor.
0 Kudos