Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm a bit confused as I'm trying to figure out how to set my output extent before creating Thiessen Polygons in a loop of ~100 points shapefile. (ArcMAP 10.0 - Python)

for i in range(3,51,1):
    arcpy.CreateThiessenPolygons_analysis("AVF%i" % i,"AVF%iVoronoi" % i,"ONLY_FID")

Basically I want my extent to be the same for each iteration.

I first found:


then someone told me about this ESRI help page:

#use 'CURRENT' if running from arcmap, when published use MXD on disk

    mxd = arcpy.mapping.MapDocument("CURRENT")

    df = arcpy.mapping.ListDataFrames(mxd)[0]
    newExtent = df.extent
    newExtent.XMin, newExtent.YMin = 293490,5898230
    newExtent.XMax, newExtent.YMax = 316430,5930230
    df.extent = newExtent

but in any case, when I run my loop, the size of the output is not reflecting the changes...

so at this point any help is wlecome !


ps: http://stackoverflow.com/questions/8996965/output-extent-environment-setting/8997122#8997122

share|improve this question

1 Answer 1

up vote 4 down vote accepted

I think you are just creating an Extent object with:


...but not actually setting the arcpy.env.extent property (unless you have more code that is not posted in your original question). From the docs:

import arcpy

# Set the extent environment using a keyword.
arcpy.env.extent = "MAXOF"

# Set the extent environment using the Extent class.
arcpy.env.extent = arcpy.Extent(-107.0, 38.0, -104.0, 40.0)  # <-- Have you tried this?

# Set the extent environment using a space-delimited string.
arcpy.env.extent = "-107.0 38.0 -104.0 40.0"

Try setting it like:

arcpy.env.extent = arcpy.Extent(293490,5898230,316430,5930230)
share|improve this answer
Hi, thanks it works perfectly ! import arcpy mxd = arcpy.mapping.MapDocument("C:/Users/nlec002/Documents/ArcGIS/Voronoi/AVFVoronoi.‌​mxd") for i in range(3,51,1): arcpy.CreateThiessenPolygons_analysis("C:/Users/nlec002/Documents/ArcGIS/Voronoi‌​/AVF%i.shp" % i,"C:/Users/nlec002/Documents/ArcGIS/Voronoi/AVF%iVoronoi.shp" % i,"ONLY_FID") arcpy.env.extent = arcpy.Extent(267936,5892195,341661,5940210) –  user1166251 Jan 25 '12 at 5:19

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.