Select to view content in your preferred language

Update Feature Class Attributes Automatically

3060
10
10-25-2012 10:05 AM
ModernElectric
Frequent Contributor
Greetings-
    I am working on a work-flow process that will automatically update the attributes of a specific feature class from a scheduled python script that will run overnight. Here is what I am trying to accomplish:

Feature Class: Service Locations (Electric Meter Locations with account, meter and location data stored in our CIS system.)
    I currently have a python script the pulled the data from our Oracle System and produces it into a Geodatabase table that sits in the same geodatabase as the Service Location feature class. What I need to do is to take the individual fields from the table and update the fields in the feature class.

This is what I have done:
    I made a data model through model builder to 1) Make a Feature Layer 2) Add Join 3) Calculate Field (Update the feature class field with the same field from the data table.

Problem is - when I run the data model or the script - it takes a LONG time. The one script I build and tested only have 7 fields (so 7 Calculate Field processes) and it took about 4 hours to run.

Is there an easier way to do this?

Thanks in advanced
Tags (2)
0 Kudos
10 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Chris,

What type of geodatabase are you using (i.e. ArcSDE for Oracle, File Geodatabase)?

What version of ArcGIS are you running?
0 Kudos
ModernElectric
Frequent Contributor
Hi Chris,

What type of geodatabase are you using (i.e. ArcSDE for Oracle, File Geodatabase)?

What version of ArcGIS are you running?


I am currently using a File Geodatabase - single use license on ArcMap 10 - ArcEditor.

Thanks
0 Kudos
KevinBell
Deactivated User
How many features are you updating?  Even if it's thousands it should take 4 seconds, not 4 hours...  By the way, the da.updatecursor will be a lot faster than the older non-da cursor.
0 Kudos
ModernElectric
Frequent Contributor
How many features are you updating?  Even if it's thousands it should take 4 seconds, not 4 hours...  By the way, the da.updatecursor will be a lot faster than the older non-da cursor.


My Service_Location feature class has around 9600 features (or 9600 meter locations). After going back to reviewing the log I created for the script it showed that each field took around 15 minutes to run through the "Calculate Field" tool in the script.

da.updatecursor vs non-da cursor????????

I am far from being an expert on Python. I basically built a model from model builder - exported it out to a python script, found out how to add a create log feature and I had my script.

Thanks
0 Kudos
MathewCoyle
Honored Contributor
My Service_Location feature class has around 9600 features


Unless you are calculating pi to 1000 decimal places for each row that should be a matter of seconds, not hours. I have a script that takes 2 hours that calculates 17 fields for nearly 1 million features.

Post your code and I'm sure someone will be able to figure out where the problem is.


da.updatecursor vs non-da cursor????????

This is a new method of accessing data using cursors in 10.1. If you are on 10.0 you don't need to worry about it as only regular cursors are available.
0 Kudos
ModernElectric
Frequent Contributor
Unless you are calculating pi to 1000 decimal places for each row that should be a matter of seconds, not hours. I have a script that takes 2 hours that calculates 17 fields for nearly 1 million features.

Post your code and I'm sure someone will be able to figure out where the problem is.


Okay - great. What "ArcTools" if any are you using to do that? I am using Calculate Field and writing an Expression saying to take this field from the table to put it into this field inside the feature class. For each field to do all 9600 features it takes a good 15 to 20 minutes. Is there something I am not doing right?
0 Kudos
MathewCoyle
Honored Contributor
Okay - great. What "ArcTools" if any are you using to do that? I am using Calculate Field and writing an Expression saying to take this field from the table to put it into this field inside the feature class. For each field to do all 9600 features it takes a good 15 to 20 minutes. Is there something I am not doing right?


I posted the essence of my solution in the linked thread below to calculate a few of the fields.

http://forums.arcgis.com/threads/55099-Update-cursor-with-joined-tables-work-around-w-dictionaries
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Okay - great. What "ArcTools" if any are you using to do that? I am using Calculate Field and writing an Expression saying to take this field from the table to put it into this field inside the feature class. For each field to do all 9600 features it takes a good 15 to 20 minutes. Is there something I am not doing right?


Are you accessing the File Geodatabase over a network?  If so, can you copy the File Geodatabase to your local disk and see if performance is the same?
0 Kudos
ModernElectric
Frequent Contributor
Mathew - I am not familiar with dictionaries when it comes to dealing with Python scripting and ArcGIS. Is there some reference material on the web you can point me to that I can do some "Homework" on?

Jake - Currently - I am running the File Geodatabase through a network connection from our internal server. Not ArcGIS Server. I can test your thought by putting the geodatabase onto my hard drive and see if that speeds things up. Than - I need to create a task to update the "Production" Geodatabase on our network since that is the one that is used to produce the maps for our operations staff at night.

Any other thoughts?

Thanks for the ideas. I am experimenting with different things to see what will work better/quicker.
0 Kudos