<?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: Data Frame Coordinates in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/data-frame-coordinates/m-p/56240#M660</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you can do this with python. The script below will take the coordinates from the 1st data frame in a mxd (in the units of the frame's coordinate system) and create a polygon out of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I made it store the x, y values in the attribute table too. Again the values will be in the frame's coord. system units. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I imagine you'll probably want to make it loop through multiple mxds since you have so many. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wasn't sure of some of your specifics or exactly what you wanted the user to input so I thought I'd leave it at the example below for now. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it helps : )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

#Input
inMXD = "FILEPATH" #PLACE HOLDER
outFeature = "FILEPATH" #PLACE HOLDER

#Set MXD and (first) Dataframe
mxd = arcpy.mapping.MapDocument(inMXD)
df = arcpy.mapping.ListDataFrames(mxd)[0]

#Set default output Coordinate System to the same values as the dataframe.
arcpy.env.outputCoordinateSystem = df.spatialReference

#Initial Variables
point = arcpy.Point()
array = arcpy.Array()

#Get data frame bounding values 
dfxMax = df.extent.XMax
dfxMin = df.extent.XMin
dfyMax = df.extent.YMax
dfyMin = df.extent.YMin

#Create list of coordinates
coordList = [[dfxMin,dfyMin],[dfxMax,dfyMin],[dfxMax,dfyMax],[dfxMin,dfyMax]]

for coordPair in coordList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; point.X = coordPair[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; point.Y = coordPair[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(point)

#Re-add first point to array to close polygon
array.add(array.getObject(0))

#Create Polygon
polygon = arcpy.Polygon(array,df.spatialReference)

#Creature Feature
arcpy.CopyFeatures_management(polygon, outFeature)

#Add fields for calculated x and y values
coords = [dfxMax, dfxMin, dfyMax, dfyMin]
fieldNames = ["xMax","xMin","yMax","yMin"]
i = 0
for fieldName in fieldNames:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFeature, fieldName, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFeature, fieldName, coords&lt;I&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1
&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:08:21 GMT</pubDate>
    <dc:creator>BenjaminGale</dc:creator>
    <dc:date>2021-12-10T22:08:21Z</dc:date>
    <item>
      <title>Data Frame Coordinates</title>
      <link>https://community.esri.com/t5/mapping-questions/data-frame-coordinates/m-p/56239#M659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone, sorry if this is in the wrong thread but i'm not quite sure where to post this. I need some help with a problem i'm trying to solve. Here is my situation; I am trying to pull the x1, x2, y1, and y2 coordinates from my data frame, create a feature class from that and automatically edit those fields with input from the user. I looked around the site a bit before posting, and found something about Image Rectangle which looks promising but my skills in C are not quite up to par to code something for ArcGIS. I am using ArcGIS 10.0 and i'm not to familiar with all the new tools from 9.3.1 yet and I didn't see any tools that would allow me to do this. Is there an easy way to do this rather than going in and doing this manually for every mxd I have? (300-400 mxds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any response or help is greatly appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 23:56:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-frame-coordinates/m-p/56239#M659</guid>
      <dc:creator>PatrickFischer1</dc:creator>
      <dc:date>2011-09-01T23:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Data Frame Coordinates</title>
      <link>https://community.esri.com/t5/mapping-questions/data-frame-coordinates/m-p/56240#M660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you can do this with python. The script below will take the coordinates from the 1st data frame in a mxd (in the units of the frame's coordinate system) and create a polygon out of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I made it store the x, y values in the attribute table too. Again the values will be in the frame's coord. system units. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I imagine you'll probably want to make it loop through multiple mxds since you have so many. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wasn't sure of some of your specifics or exactly what you wanted the user to input so I thought I'd leave it at the example below for now. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it helps : )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

#Input
inMXD = "FILEPATH" #PLACE HOLDER
outFeature = "FILEPATH" #PLACE HOLDER

#Set MXD and (first) Dataframe
mxd = arcpy.mapping.MapDocument(inMXD)
df = arcpy.mapping.ListDataFrames(mxd)[0]

#Set default output Coordinate System to the same values as the dataframe.
arcpy.env.outputCoordinateSystem = df.spatialReference

#Initial Variables
point = arcpy.Point()
array = arcpy.Array()

#Get data frame bounding values 
dfxMax = df.extent.XMax
dfxMin = df.extent.XMin
dfyMax = df.extent.YMax
dfyMin = df.extent.YMin

#Create list of coordinates
coordList = [[dfxMin,dfyMin],[dfxMax,dfyMin],[dfxMax,dfyMax],[dfxMin,dfyMax]]

for coordPair in coordList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; point.X = coordPair[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; point.Y = coordPair[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(point)

#Re-add first point to array to close polygon
array.add(array.getObject(0))

#Create Polygon
polygon = arcpy.Polygon(array,df.spatialReference)

#Creature Feature
arcpy.CopyFeatures_management(polygon, outFeature)

#Add fields for calculated x and y values
coords = [dfxMax, dfxMin, dfyMax, dfyMin]
fieldNames = ["xMax","xMin","yMax","yMin"]
i = 0
for fieldName in fieldNames:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outFeature, fieldName, "DOUBLE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outFeature, fieldName, coords&lt;I&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1
&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:08:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-frame-coordinates/m-p/56240#M660</guid>
      <dc:creator>BenjaminGale</dc:creator>
      <dc:date>2021-12-10T22:08:21Z</dc:date>
    </item>
  </channel>
</rss>

