gnewburyiv

ArcPy Update Cursor vs. Calculate Field Geoprocessing Tool

Discussion created by gnewburyiv on Nov 16, 2011
Latest reply on Apr 7, 2015 by sephefox
Thought I'd share my experience with topic.

I'm reading a CSV file, making a feature layer from it, and performing transformations on the geometry.  In the end I'm updating the feature class's fields with the geometry, e.g. Point.X, .Y, and .Z going into 'Easting', 'Northing', and 'Altitude' fields.  At first I used the 'Calculate Field' tool for each field. Of course to do this I had to use the tool three times, one for each field.  Next I tried using one update cursor and thus doing all three updates in one loop through the feature class. I found it shaved off 3-4 seconds. 

If you need to go through and calculate multiple fields then you may want to consider using the Update Cursor instead of the 'Calculate Field' tool. It could save you a lot of time.

Outcomes