<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automating capture of Extent from multiple mxds with multiple dataframes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196501#M15075</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am very new to Python (and coding), and I cannot manage to get any of the codes on this page to work. All but one ends in errors, and the one that doesn't, posted by Jake Skinner on May 10, 2011, seems to freeze or something. I can't tell if it is actually doing anything, so I exit out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried &lt;SPAN class=""&gt;&lt;A _jive_internal="true" data-userid="10608" data-username="npeihl" href="https://community.esri.com/people/npeihl"&gt;Nicholas Peihl&lt;/A&gt;&lt;/SPAN&gt;'s Map Index found here: &lt;A class="link-titled" href="https://bitbucket.org/npeihl/mapindextool/wiki/Home" title="https://bitbucket.org/npeihl/mapindextool/wiki/Home"&gt;npeihl / MapIndexTool / wiki / Home — Bitbucket&lt;/A&gt; . It has so much potential of being the perfect tool for what I need, but it only works on the biggest map extent in each MXD, and unfortunately, my series of maps and data frame in question is not the biggest map on the layout (think of it as an insert). I tried changing it to a for loop instead of an if else, but upon running it tells me it is formatted incorrectly, and I can't find the problem. Same problem if I change it to look for a specific data frame name. If I could get it to work, I would add another field where it includes the Data Frame name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody help me?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Sep 2016 22:04:44 GMT</pubDate>
    <dc:creator>HeatherCowley1</dc:creator>
    <dc:date>2016-09-15T22:04:44Z</dc:date>
    <item>
      <title>Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196478#M15052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to create a single shape file from multiple mxd's that have multiple frame sets with different extents in them. I have found/started a script to do this (attached) but can't figure out how to write the captured X&amp;amp;Y Max/Min into the shape file that is created for this. See output below. I also want it to write the scale and title of the frame as well as the file name of the mxd.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would appreciate your help in completing this script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy, os, glob&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #path = 'c:\\temp\\george\\'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... path = 'P:\\2011\\Job_031_TownPlanning_SeriesProduction\\Working\\mxd\\1'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... os.chdir(path)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... mxds_List = glob.glob('*.mxd')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... count_Mapdocs = len(mxds_List)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... print 'Processing ' + str(count_Mapdocs) + 'map documents...'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #Create Polygon Shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.CreateFeatureclass_management(path, 'extents.shp', "POLYGON")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #Start Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... for mxd in mxds_List:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapDoc = arcpy.mapping.MapDocument(mxd)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe = arcpy.mapping.ListDataFrames(mapDoc,'*')[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frameExtent = dataframe.extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Frame Scale&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frameScale = dataframe.scale&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Frame Extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExtentXMax = frameExtent.XMax&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExtentXMin&amp;nbsp; = frameExtent.XMin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExtentYXax&amp;nbsp; = frameExtent.YMax &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExtentYMin&amp;nbsp; = frameExtent.YMin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point_object = mxd.shp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Write in table scale&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Write in table&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Processing 14map documents...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;type 'exceptions.AttributeError'&amp;gt;: 'str' object has no attribute 'shp'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2011 22:14:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196478#M15052</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2011-04-19T22:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196479#M15053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the problem in you code is mxd.shp is interpreted as mxd = variable (defined in the for loop "for mxd in mxds_List") and .shp is interpreted as an attiribute of your mxd variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try changing the name of the point object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ciao,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 09:22:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196479#M15053</guid>
      <dc:creator>AlessandroCinnirella</dc:creator>
      <dc:date>2011-04-20T09:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196480#M15054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I use&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.CreateFeatureclass_management(path, 'mxd2.shp', "POLYGON")
point_object = mxd2.shp&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Processing 14map documents...&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\extent.py", line 29, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; point_object = mxd2.shp&lt;BR /&gt;NameError: name 'mxd2' is not defined&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196480#M15054</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2021-12-11T09:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196481#M15055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is some sample code that I was able to get working. You will need to create an array and add the XMAX, XMIN, etc to the array to create the polygon feature. Then you can create a feature class/shapefile from this array. I had trouble getting the Append tool to work with the array feature so I created a feature class for each extent, merged them together, and then deleted the original extent feature classes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, glob, os
from arcpy import env
from arcpy import mapping
env.overwriteOutput = True

path = r"C:\temp"
mxdList = glob.glob(path + "\*.mxd")

env.workspace = r"C:\temp\Test.gdb"

y = 1

for mxd in mxdList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd2 = mapping.MapDocument(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe = mapping.ListDataFrames(mxd2, "*")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; frameExtent = dataframe.extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; XMAX = frameExtent.XMax
&amp;nbsp;&amp;nbsp;&amp;nbsp; XMIN = frameExtent.XMin
&amp;nbsp;&amp;nbsp;&amp;nbsp; YMAX = frameExtent.YMax
&amp;nbsp;&amp;nbsp;&amp;nbsp; YMIN = frameExtent.YMin
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1 = arcpy.Point(XMIN, YMIN)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2 = arcpy.Point(XMIN, YMAX)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt3 = arcpy.Point(XMAX, YMAX)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt4 = arcpy.Point(XMAX, YMIN)
&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt4)
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(y))
&amp;nbsp;&amp;nbsp;&amp;nbsp; y = y + 1


list = []

lstFCs = arcpy.ListFeatureClasses("Polygon_Extent*")
for fc in lstFCs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(fc)

arcpy.Merge_management(list, "Extent")

for item in list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(item)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196481#M15055</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T09:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196482#M15056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;J, Thanks for the code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run it I got the following&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\extent_creation.py", line 32, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(y))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 1943, in CopyFeatures&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 000210: Cannot create output Polygon_Extent_1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CopyFeatures).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to open/close the file&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array)
&amp;nbsp;&amp;nbsp;&amp;nbsp; TempFile = open(polygon, "Polygon_Extent" + "_" + str(y)) # open file
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(y))
&amp;nbsp;&amp;nbsp;&amp;nbsp; TempFile.close() # close file
&amp;nbsp;&amp;nbsp;&amp;nbsp; y = y + 1 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but then get &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\extent_creation.py", line 32, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TempFile = open(polygon, "Polygon_Extent" + "_" + str(y)) # open file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TypeError: coercing to Unicode: need string or buffer, Polygon found&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using Python 2.65 which came with ArcGIS 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your assistance,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196482#M15056</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2021-12-11T09:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196483#M15057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you have your env.workspace set to a File Geodatabase?&amp;nbsp; Can you post the entire code you are using?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 09:48:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196483#M15057</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-05-06T09:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196484#M15058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I recently created an application very similar to what you are looking for. However, my application only captures the largest dataframe in each map. But I think you could easily adapt my code using a for loop for the dataframes. I've attached a zip file of my application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You'll find my code in the Scripts folder.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 21:30:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196484#M15058</guid>
      <dc:creator>deleted-user-1T_bOHag6M8d</dc:creator>
      <dc:date>2011-05-06T21:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196485#M15059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Do you have your env.workspace set to a File Geodatabase?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nope. How would I do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can you post the entire code you are using?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is the same that you sent me with just the changes I included.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 May 2011 21:06:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196485#M15059</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2011-05-07T21:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196486#M15060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To set the environment workspace, you will use arcpy.env.workspace.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"C:\data\Philadelphia.gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It will still help to post all of your code.&amp;nbsp; I can check to see if there are any errors with the changes you made.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 09:22:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196486#M15060</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-05-09T09:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196487#M15061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jake.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please see the attached script and rar file with some of the MXD's I am trying to get the extents from. I appreciate your time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With this code I now get the following errors. I'm not sure why some values (YMax/Min? and Pnt3&amp;amp;4) get reported as Not a Number (NaN)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;geoprocessing Map object object at 0x15D750A0&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;geoprocessing Data Frame object object at 0x15D7B4A8&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;219157.947938379 8072842.27839025 377350.947938381 8205437.27839025 NaN NaN NaN NaN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;377350.947938 219157.947938 8205437.27839 8072842.27839&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;219157.947938379 8072842.27839025 NaN NaN 219157.947938379 8205437.27839025 NaN NaN 377350.947938381 8205437.27839025 NaN NaN 377350.947938381 8072842.27839025 NaN NaN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "P:/2011/Job_031_TownPlanning_SeriesProduction/Working/mxd/1/extent_creation2.py", line 38, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TempFile = open(polygon, "Polygon_Extent" + "_" + str(y)) # open file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TypeError: coercing to Unicode: need string or buffer, Polygon found&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;best,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 22:56:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196487#M15061</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2011-05-09T22:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196488#M15062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nicholas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for sending the code. When I try it, I get the following even though there are ver 10 MXD's in the directory. Please see the attachment (2.rar) to my last post. Following change was made to the code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#scriptPath = sys.path[0]
scriptPath = r'P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing: mapindex&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start Time: Tue May 10 11:59:56 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Running script mapindex...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Script path is P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No ArcMap Documents were found in this folder. Please try another folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Completed script mapindex...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (mapindex).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed at Tue May 10 11:59:56 2011 (Elapsed Time: 0.00 seconds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;best,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196488#M15062</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2021-12-11T09:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196489#M15063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Nicholas,&lt;BR /&gt;&lt;BR /&gt;Thanks for sending the code. When I try it, I get the following even though there are ver 10 MXD's in the directory. Please see the attachment (2.rar) to my last post. Following change was made to the code...&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#scriptPath = sys.path[0]
scriptPath = r'P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;Executing: mapindex&lt;BR /&gt;Start Time: Tue May 10 11:59:56 2011&lt;BR /&gt;Running script mapindex...&lt;BR /&gt;Script path is P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1&lt;BR /&gt;No ArcMap Documents were found in this folder. Please try another folder.&lt;BR /&gt;Completed script mapindex...&lt;BR /&gt;Failed to execute (mapindex).&lt;BR /&gt;Failed at Tue May 10 11:59:56 2011 (Elapsed Time: 0.00 seconds)&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;best,&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chandeep,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My script looks for MXDs in the arcpy.env.workspace setting which is set by the wp variable, not the scriptPath.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you keep my folder structure the same, you should need to make changes to the scriptPath. The only change you should need is to the wp and spatialRef variables. My script uses a custom ArcGIS tool in the root folder which allows you to select these variables. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you try running the MapIndexTool in the toolbox in either ArcCatalog or ArcMap and see if it works for you. A shapefile will be created in the same folder as the MXDs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196489#M15063</guid>
      <dc:creator>deleted-user-1T_bOHag6M8d</dc:creator>
      <dc:date>2021-12-11T09:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196490#M15064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for sending your code and MXDs.&amp;nbsp; I didn't take into consideration that you had multiple dataframes within your MXDs.&amp;nbsp; I've updated the code to work with this.&amp;nbsp; There were a few small syntax errors within the code you sent.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;env.workspace = path + 'extents.gdb'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a '\' missing.&amp;nbsp; Should be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;env.workspace = path + '\extents.gdb'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for mxd in mxdList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = mapping.MapDocument(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxd # Printing status for error checking
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe = mapping.ListDataFrames(mxd2, "*")[0]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Need to change the second 'mxd' to 'mxd2':&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for mxd in mxdList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd2 = mapping.MapDocument(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxd # Printing status for error checking
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe = mapping.ListDataFrames(mxd2, "*")[0]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also removed the 'Tempfile' from the code.&amp;nbsp; This isn't really needed, but the code may still work with it added (did not test though).&amp;nbsp; Below is the updated code.&amp;nbsp; This code will also iterate through all dataframes in each MXD:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, glob, os
from arcpy import env
from arcpy import mapping
env.overwriteOutput = True

path = os.getcwd() # Script in same directory as files being processed
mxdList = glob.glob(path + "\*.mxd")
env.workspace = path + '\extents.gdb' # Directory as files being processed
print env.workspace

x = 0
y = 1
z = 1

while y &amp;lt; 7:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for mxd in mxdList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd2 = mapping.MapDocument(mxd)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe = mapping.ListDataFrames(mxd2, "*")&lt;X&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frameExtent = dataframe.extent
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XMAX = frameExtent.XMax
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XMIN = frameExtent.XMin
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YMAX = frameExtent.YMax
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YMIN = frameExtent.YMin
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1 = arcpy.Point(XMIN, YMIN)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2 = arcpy.Point(XMIN, YMAX)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt3 = arcpy.Point(XMAX, YMAX)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt4 = arcpy.Point(XMAX, YMIN)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt3)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt4)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(pnt1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(z))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = z + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except IndexError:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; x = x + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; y = y + 1

list = []

lstFCs = arcpy.ListFeatureClasses("Polygon_Extent*")
for fc in lstFCs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(fc)

arcpy.Merge_management(list, "Extent")

for item in list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(item)
&lt;/X&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For "while &amp;gt; 7:", the number can be any value that is larger than the max amount of dataframes in any individual MXD.&amp;nbsp; For example, if you had an MXD that has 10 dataframes you should increase this number to 10 (dataframe indexing begins at 0).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196490#M15064</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T09:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196491#M15065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake, Thanks again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without any changes to the script I get&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\extents.gdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\extent_creation3.py", line 36, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(z) + ".shp")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 1943, in CopyFeatures&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 000210: Cannot create output Polygon_Extent_1.shp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CopyFeatures).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did your code work on your machine? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems like this is a rw error so I tried to create the shp file as below and it created the file but you still get the same error as above. It also could be an error in "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 1943, in CopyFeatures? but I am on a default installation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create Polygon Shapefile
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(path, "Polygon_Extent" + "_" + str(z), "POLYGON")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(z))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z = z + 1
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Also I wanted to check - are the following correct?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. while y &amp;lt; 7: === this loop creates a shp file with the extents of each dataframe? I guess I can use the same loop to also add in the scale and name of the dataframe into the shp file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. for fc in lstFCs: ==== take all the "polygon_extent_*.shp" files and merge them into extents.shp?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. for item in list: ==== delete the "polygon_extent_*.shp"?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196491#M15065</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2021-12-11T09:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196492#M15066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jake,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I got the script to work. We were trying to write to extent.gdb but didn't create it, also needed to create the poly*.shp files before writing to them. I will post the full code tomorrow as it's on my office computer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To add the ExtentID I added the following code but it doesn't extract the full name properly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for el in arcpy.mapping.ListLayoutElements(mxd2, "DATAFRAME_ELEMENT"):
 ExtentIDStore = str(el.name)
 print ExtentIDStore #used to see which item to add to the shape file 
 print ExtentIDStore&lt;X&gt; # should show the full entry at storage x but instead shows the character at x&lt;/X&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Also I wanted to check - are the following correct?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. while y &amp;lt; 7: === this loop creates a shp file with the extents of each dataframe? I guess I can use the same loop to also add in the scale and name of the dataframe into the shp file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. for fc in lstFCs: ==== take all the "polygon_extent_*.shp" files and merge them into extents.shp?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. for item in list: ==== delete the "polygon_extent_*.shp"?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196492#M15066</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2021-12-11T09:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196493#M15067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Jake,&lt;BR /&gt;&lt;BR /&gt;1. while y &amp;lt; 7: === this loop creates a shp file with the extents of each dataframe? I guess I can use the same loop to also add in the scale and name of the dataframe into the shp file?&lt;BR /&gt;2. for fc in lstFCs: ==== take all the "polygon_extent_*.shp" files and merge them into extents.shp?&lt;BR /&gt;3. for item in list: ==== delete the "polygon_extent_*.shp"?&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The script is intended to create feature classes within the Extents.gdb, which you will need to create before running the script.&amp;nbsp; This is why you were receiving errors referencing shapefiles.&amp;nbsp; I believe since the file geodatabase did not exist, the script attempted to create a shapefile.&amp;nbsp; The 'env.workspace' is set to the Extents.gdb, so all output should be written here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; The while loop with iterate through each mxd starting with the first dataframe&lt;X&gt;, where x = 0.&amp;nbsp; X will then increase by 1 and iterate through each mxd with the next dataframe[1].&amp;nbsp; If the dataframe does not exist, for example the mxd does not contain dataframe[4], the script will execute the 'except' and pass the index error.&amp;nbsp; Yes, you could use the same loop to add the scale and dataframe name to the &lt;/X&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;feature class&lt;/SPAN&gt;&lt;SPAN&gt;, but this will take some more coding.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; This will take all 'polygon_extent' &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;feature classes&lt;/SPAN&gt;&lt;SPAN&gt; and merge them into one feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; After the 'polygon_extent' feature classes are merged into one, it will delete the individual 'polygon_extent' feature classes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2011 09:44:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196493#M15067</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-05-11T09:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196494#M15068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have added to the code to capture the extent ID (it can fill in filename as 'mxd' and not sure how to capture scale) but it is giving errors in identifying the x'th entry in to the list -it prints just the x'th character. Also it's not clear where to put a print statment to give feedback that the program is working on the 2,3,4th etc mxd file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&amp;gt;&amp;gt;&amp;gt; &lt;BR /&gt;Reading mxd files from P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1&lt;BR /&gt;Working in P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\temp_extents&lt;BR /&gt;Processing P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\TownPlanning_Bushfire_Overlay_Ver2-Herberton.mxd&lt;BR /&gt;Created...Polygon_Extent_1&lt;BR /&gt;Irvinebank&lt;BR /&gt;I&lt;BR /&gt;Watsonville&lt;BR /&gt;W&lt;BR /&gt;Overview&lt;BR /&gt;O&lt;BR /&gt;Herberton&lt;BR /&gt;H&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here ExtentIDStore prints the whole value but ExtentIDStore&lt;X&gt; only prints the x'th character rather than the value in the x'th position.&lt;/X&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also notice that it loops first through the mxd's creating extent 1, then loops through creating extent 2 etc. I was initially thinking that it opened the first mxd, cycled through and created all the extent polygons and then opened the next mxd and created the extents. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\extent_creation4.py", line 78, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.InsertCursor(FileRef)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 837, in InsertCursor&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.insertCursor(*args)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 367, in insertCursor&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.InsertCursor(*gp_fixargs(args)))&lt;BR /&gt;RuntimeError: ERROR 999999: Error executing function.&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what to do?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 00:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196494#M15068</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2011-05-12T00:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196495#M15069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I have added to the code to capture the extent ID (it can fill in filename as 'mxd' and not sure how to capture scale) but it is giving errors in identifying the x'th entry in to the list -it prints just the x'th character. Also it's not clear where to put a print statment to give feedback that the program is working on the 2,3,4th etc mxd file.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will need to append the extent ID to a list.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for el in arcpy.mapping.ListLayoutElements(mxd2, "DATAFRAME_ELEMENT"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExtentIDStore = str(el.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list2.append(ExtentIDStore)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you can use print statement for the list:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;print list2[0]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I also notice that it loops first through the mxd's creating extent 1, then loops through creating extent 2 etc. I was initially thinking that it opened the first mxd, cycled through and created all the extent polygons and then opened the next mxd and created the extents. &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can code it to do it this way, but the end result will be the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Also it's not clear where to put a print statement to give feedback that the program is working on the 2,3,4th etc mxd file.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can execute a print statement at the beginning of the first 'for' loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for mxd in mxdList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd2 = mapping.MapDocument(mxd) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, the same MXD name will be printed multiple times since the code loops through each MXD multiple times.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196495#M15069</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T09:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196496#M15070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jake,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Then you can use print statement for the list:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;print list2[0]&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried but I get an error --&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\Extent_Generation.py", line 58, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; list2.append = ExtentIDStore&lt;BR /&gt;AttributeError: 'str' object has no attribute 'append'&lt;/BLOCKQUOTE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to figure out why from the esri/python help system but can't understand the reason for it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;----&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;I am also not able to get the write function to work and do you know if I can capture the scale.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the write functions I get the following errors...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;BR /&gt;&amp;nbsp; File "P:\2011\Job_031_TownPlanning_SeriesProduction\Working\mxd\1\Extent_Generation.py", line 81, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.InsertCursor(FileRef)&lt;BR /&gt;NameError: name 'FileRef' is not defined&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's not very important but I am trying to delete the temp directory at the start of the script but the code I tried to use doesn't seem to work as part of the script, although it's fine when run in the arcmap python window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for all your support and help on this...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2011 08:07:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196496#M15070</guid>
      <dc:creator>George_ChandeepCorea</dc:creator>
      <dc:date>2011-05-13T08:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Automating capture of Extent from multiple mxds with multiple dataframes</title>
      <link>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196497#M15071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was trying to make a polygon based on the extent of a layer and so I used code very much like what's on this thread &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Find extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Create poly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Copy Feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it gives me a polygon with no area (and evidence of existence on the map).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's weird that none you seem to mention this problem, so I'm wondering if a new bug has arrived with one of the service packs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's some sample code that runs 'successfully' but creates a polygon of area zero.&amp;nbsp; I'd attach a pic of my output polygon, but I think you can picture it in your heads.&amp;nbsp; Imagine some empty white space!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(I can probably just use a min. bounding box tool call instead, but I'd still like to know if the polygon creation is broken.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import sys, arcpy

dataDir = "C:/Temp"
arcpy.overwriteOutput = True
arcpy.env.workspace = dataDir

#Get extent
fc = "input.shp"
desc = arcpy.Describe(fc)
extent = desc.Extent

#Create polygon
pts = [ [extent.XMin, extent.YMin],
[extent.XMin, extent.YMax],
[extent.XMax, extent.YMax],
[extent.XMax, extent.YMin] ]
point = arcpy.Point()
array = arcpy.Array()

for pt in pts:
&amp;nbsp;&amp;nbsp;&amp;nbsp; point.x = pt[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; point.y = pt[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(point)
array.add(array.getObject(0))

SR = desc.spatialReference
poly = arcpy.Polygon(array,SR)

#Copy features
arcpy.CopyFeatures_management(poly, "Polygon_Extent")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automating-capture-of-extent-from-multiple-mxds/m-p/196497#M15071</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2021-12-11T09:49:19Z</dc:date>
    </item>
  </channel>
</rss>

