geoprocessing tool output to geometry object in for loop

Discussion created by cdevenish on Feb 13, 2011
Latest reply on May 27, 2015 by wcwhiteford

I'm new to python (and programming in general), in a script I want to loop through a feature class, use a geoprocessing tool on each row, and access the area of the new (temporary features) created by the tool. 

On the help pages for the geometry object, it states that a blank object can be created for temporary output, for example:

workspace = ".../file.gdb"
testShape = ".../test_graphics"
dBufDis = -10

g = arcpy.Geometry()
geometryList = arcpy.Buffer_analysis(testShape, g, dBufDis)
for geometry in geometryList:
    print geometry.area

The above works on my test shape and I get a list of areas of the new buffers, however, I want to put the geoprocessing tool into a loop something like this:

rows = arcpy.SearchCursor(testShape)

for row in rows:
    g = arcpy.Geometry() 
    rowShape = row.getValue(shapeName)
    arcpy.Buffer_analysis(rowShape, g, dBufDis)

and then access the area for each row, but this is where I can't seem to get to the area property of the temporary geoprocessing output. Why doesn't "g.area" return the area? If .area is a property of the geometry object? Hasn't g been "populated" by the output of the processing tool for each row?

Thanks for any help.