Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

arcpy.da.UpdateCursor using geometry

$
0
0
I am having a difficult time understanding geometry as a concept accessed by the da module.

For example, I created a new feature class using the clip geoprocessing tool. I want to update the "HECTARES" field, as well as add a "Shape_Area" field that is updated with Shape@Area geometry.

Code:

arcpy.Clip_analysis(fireLayer,refugeLayer,outLayer)
arcpy.AddField_management(outLayer,"Shape_Area", "DOUBLE")
updateRows = arcpy.da.UpdateCursor\
            (outLayer,["HECTARES","Shape@Area"])

for row in updateRows: #fields --> 0:Hectares, 1:ShapeArea
    HA = row[1]/10000 #Area in hectares
    row[0] = HA #assign value to each row of Hectares
    row[1] = ["Shape@Area"]
    updateRows.updateRow(row) #save it by using the updateRow function
del updateRows # unlock cursor
del row #remove cursor pointer

This code will update my "HECTARES" field if I comment out the line
Code:

    row[1] = ["Shape@Area"]
which leads me to believe that while row[1] remains empty, it still has access to the Shape@Area geometry.

Thanks.

Viewing all articles
Browse latest Browse all 2485

Trending Articles