Take the 2-minute tour ×

I want a python script that tells me the Xmin, Xmax, Ymin, and Ymax of a polygon. (I guess this is finding the extent of a polygon?)

My current script gives me the correct the Xmin and Xmax, but it gives me the Ymin and Ymax of the data frame. I want the Ymin and Ymax of a polygon.

Here is my current code:

# Specify the shapefile
shapeFile = "C:/Big_Creek_MapUnits.shp"

# Use the describe function
desc = arcpy.Describe(shapeFile)

# Print stuff out

Anyone have any solutions or tips?

share|improve this question
Thank you. I mean polygon. –  user1191849 Sep 18 '12 at 7:16
add comment

2 Answers

up vote 7 down vote accepted

Answered here: How to get the extent of each polygon in a shapefile?

rows = arcpy.SearchCursor(inFeatures)
shapeName = arcpy.Describe(inFeatures).shapeFieldName
for row in rows:
    feat = row.getValue(shapeName)
    extent = feat.extent
    print extent.XMin,extent.YMin,extent.XMax,extent.YMax
share|improve this answer
add comment




share|improve this answer
add comment

Your Answer


