4

This question already has an answer here:

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?

merged by PolyGeo Aug 11 '15 at 0:58

This question was merged with Obtaining extent of each polygon in shapefile using ArcPy? because it is an exact duplicate of that question.

Browse other questions tagged or ask your own question.