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

I want to calculate the area of each polygon in a shapefile. How do I control what the units of measurement are?

def getArea(shapefile):
    """Print area of polygons"""

    Rows = ARCPY.SearchCursor( shapefile ) 

    for row in Rows:

        tmp_area = row.area # this assumes a field name 'area' exists
        print str(tmp_area) 

I looked to see if there is any setting in the arcpy.env. module but could not find one. If I do set the units in my python script, does that mean that all aspects of the shapefile remain unchanged? For example, if the shapefile had units of feet, in my script I change the units to KM, will the shapefile still have units of feet afterwards?

share|improve this question
up vote 6 down vote accepted

Units are always tied to your coordinate system. Assuming we're talking about a projected coordinate system, the units are in the units used by the spatial reference of your dataset. If you're dataset is in meters, your area will be in square meters. You should be able to get this info from your dataset's spatial reference. You can get your dataset's spatial reference with:

sr = arcpy.Describe(dataset).spatialReference
unit = sr.linearUnitName 

To answer your second question, calculating area in some unit other than what your spatial reference uses will not modify the underlying data. The only way to change the units the data uses is to use the project tool.

share|improve this answer
Thanks for the answer Swingley. I just have one question regarding this. If I use the 'Calculate Field (Data Management)' can I specify the units? For example the help here suggests that the area calculation can allow a unit to be specified:… Perhaps it is identifying what the unit of measurement is, and converting it into the chosen unit. – djq Nov 10 '10 at 19:15
Glad to help. If you're using calculate field, then yes, you can specify a unit. I'm pretty sure ArcGIS is just doing the conversion for you when it does the area calculation. – Derek Swingley Nov 10 '10 at 19:26
You can also pass in a spatial reference to Search Cursors, so you could open up a .prj file that uses the linear unit of your choice and pass it through to the cursor to have your geometries reprojected the way you want. – Jason Scheirer Nov 17 '10 at 18:55

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.