How Can I Calculate the Length and Width of a Polygon Using ArcPy any suggestion(s). Thanks

How Can I Calculate the Length and Width of a Polygon Using ArcPy any suggestion(s). Thanks

- Here's some v10.1+ code that calculates an "aspect ratio" in regards to a poly or line FC's hull rectangle (not the same as extent rectangle BTW)... The variables "distance1" and "distance2" are length and width (depending on which one is the longer distance):
arcpy.AddField_management(indxTileSinglePartFC, "ASP_RATIO", "DOUBLE") updateRows = arcpy.da.UpdateCursor(indxTileSinglePartFC, ["SHAPE@","ASP_RATIO"]) for updateRow in updateRows: shapeObj = updateRow[0] x1,y1,x2,y2,x3,y3,x4,y4 = [float(coord) for coord in shapeObj.hullRectangle.split(" ")] distance1 = math.sqrt((x1 - x2)**2 + (y1 - y2)**2) distance2 = math.sqrt((x2 - x3)**2 + (y2 - y3)**2) if distance1 <= distance2: updateRow[1] = distance2 / distance1 else: updateRow[1] = distance1 / distance2 updateRows.updateRow(updateRow) del updateRow, updateRows

http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003q000000

The graphic row for polygon shows the various geometry methods - check out RECTANGLE_BY_WIDTH, RECTANGLE_BY_AREA, and ENVELOPE.

Also, there's the convex hull property 'getHullRectangle' --- gives you a space-delimited coordinate pair string of the vertices. You can use the distance formula to back out the height/width if not oriented 'orthogonally' to the x/y axes.

http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000061000000

Wayne

EDIT- Python has a math module with trig functions that will help too.

...specifically related to the distance formula: math.hypot(x,y)

https://docs.python.org/2.7/library/math.html#trigonometric-functions