Select to view content in your preferred language

Areas of 0 returned from intersect tool

1905
2
09-17-2013 02:29 PM
SarahDoyle
Emerging Contributor
I am trying to pull area and length from the SHAPE@ object in an in memory file.  When a feature is split into 2 features after the intersect, the area is zero!  Any ideas?

        legal_sr_sec= arcpy.SpatialReference('NAD 1983 UTM Zone 13N')
        arcpy.env.outputCoordinateSystem = legal_sr_sec
        arcpy.Intersect_analysis([sections, feature], "in_memory\\sections_join")
        desc=arcpy.Describe("in_memory\\sections_join")
        if desc.shapeType == "Polygon":
            with arcpy.da.UpdateCursor("in_memory\\sections_join",["SHAPE@"]) as uc:
                for row in uc:
                    geom=row[0]
                    area=geom.getArea()
                    length=geom.getLength()
                    arcpy.AddMessage(area)
                    AtoL_num=float(area/length)
                    if AtoL_num < 1:
                        uc.deleteRow()
Tags (2)
0 Kudos
2 Replies
NeilAyres
MVP Alum
Sarah,
I am surprised you are not getting some errors with this code.
As far as I am aware the area & length of a geometry object are properties of the object. I can find no reference to a .getArea() function.
So why not try...
area = geomObject.area
length = geomObject.length

Or just recover the area and length using the tokens for this purpose (SHAPE@AREA, SHAPE@LENGTH : less expensive on resources than manipulating the full geometry object.
Cheers,
Neil
0 Kudos
SarahDoyle
Emerging Contributor
Thank you, I used the area and length tokens.  Not sure why I thought the getArea function was what I needed.
0 Kudos