Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my problem: I have an arcpy script that finds the XMax, XMin, YMax, and YMin of a polygon. It shows the results in feet, but I want them to be in decimal degrees.

In ArcMap I can change the data frame's display units to decimal degrees. But every time I run my script it shows the numbers in feet again.

Is there a solution for this in arcpy?

share|improve this question
up vote 4 down vote accepted

You can define a SearchCursor on the layer holding the polygon, and specify a spatial reference:

When specified, features will be projected on the fly using the spatial_reference provided.

See the help file under Setting a cursor's spatial reference for more info on setting up the search cursor with a new coordinate system. Once you've defined the cursor, you can find the projected extent using:

rows = arcpy.SearchCursor(featureclass,query,spatialReference)
row =
polygon = row.shape
extent = polygon.extent
share|improve this answer

Why not simply produce a new file with the coordinates projected back to decimal degrees, then run you script from the unprojected/geographic/decimal degree file, it would save a lot of work.

share|improve this answer

If you can't get an answer by using a SearchCursor (as per @StephenLead 's answer above) you could look at downloading the pyproj library. As long as you know the relevant definition of your projection (which you can get from, you can easily convert from one projection to another. For example:

import numpy as np
import pyproj

lonlat = np.array[[135.5, 135.4], [-47.5, -47.6]] #replace with your own data

vicgrid94 = pyproj.Proj(init='epsg:3111') #replace this with your own projection
gda94 = pyproj.Proj(init='epsg:4283') #Australian geographic coordinate system
                                      #WGS84 = epsg:4326 for comparison

#first option
xy = pyproj.transform(gda94, vicgrid94, lonlat[0], lonlat[1])

#first option
print vicgrid94(xy[0], xy[1], inverse=True) #With inverse=True transforms coordinates
                                            #in projection to lat long
                                            #Note: floating point error will be obvious
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.