4

I'm using ArcMap 10.

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
arcpy.AddMessage(desc.extent.Xmin)
arcpy.AddMessage(desc.extent.Xmax)
arcpy.AddMessage(desc.extent.Ymin)
arcpy.AddMessage(desc.extent.Ymax)

Anyone have any solutions or tips?

Browse other questions tagged or ask your own question.