سؤال

I would like to know how to set up the Output extent on ArcMAP using Python.

I have a loop to Create Thiessen Polygons, but I didn't mange to change my output extent the size I want.

arcpy.Extent(293490,5898230,316430,5930230)

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

Thanks for your help

هل كانت مفيدة؟

المحلول

The map extent can be set through the DataFrame object. See this ESRI help page This appears to set the current extent of the data frame. I don't know if you can set the full or maximum extent of the frame.

#arcpy.Extent(293490,5898230,316430,5930230)

#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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top