1.1 October 2, 2008
Posted by Kosmas in PYTHON.Tags: ArcGIS, ESRI, PYTHON
trackback
I though to myself that I must share with you in a turorial kind of posts how to program in ArcGIS. So I decided that I will post my tasks in two different languages Python and C#.Net.
At the moment I will try to show you examples of how you can manipulate attributes or features in personal geodatabases using c#.net and python.
My first example will be in python and will show you in practise how you can access a table and update a field by adding a unique ID in each row. I will be very grateful if you can comment my code or add your alternative way to do the job.
Firstly, we need to get the updatecursor method by doing the following
rows = gp.UpdateCursor (“the path to my table”)
We then need to start the loop to go from a row to the next row by doing the following
row = rows.Next()
while:
here you add what to do in each row and in which field by setting a value
x= x+1
row = SetValue(Field, x) # set which field to update and what value will get
Now update the row with the above value
rows = UpdateRow (Rows)
and finally move to the next row
row = rows.Next()
That is simply a 4 steps procedure when you want to update the values of a field.
Now, I need to find good links and how you can do the same thing in c#.net. If you know how to do it I would like to recieve your suggestions in my email. kosmosofgis@gmail.com
Comments»
No comments yet — be the first.