Select to view content in your preferred language

Calculate Field Based on Feature Attr Value

552
1
09-08-2010 02:02 PM
KeithSandell
Regular Contributor
I have a shapefile that has a column of data (the "area" of the polygons) that I would like to use in calculating another column, call the other column "ratio." The data/features are pre-sorted in descending order based on the area; the first feature having FID = 0.

In the "ratio" column I want to calculate the field, or cells for each feature like so:

~something like this~  "ratio" = area/FID[0].area.value

So that the resulting value is a ratio of the biggest "area" to the "area" of each other feature, i.e.

FID____AREA____RATIO
0______ 10 _____ 1
1______ 8 ______ .8
2______ 6 ______ .6
3______ 4 ______ .4

and so on...

Is my above approach workable or is there another/better way?

Thanks
0 Kudos
1 Reply
KeithSandell
Regular Contributor
I got it.

I was trying/wanting to just use a straight up expression inside of the Calculate Tool, but instead I'm going to use a SearchCursor to get the value of FID = 0.area and set it as a variable in a python script and then pass in the variable and the remainder of the expression to the Field Calculate method as a parameter.
0 Kudos