<?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: Issues in projection while defining data frame extent by coordinates in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332105#M25838</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try building the Extent object from scratch instead of reconstructing one you get from the DataFrame object.&amp;nbsp; If I understand what you are expecting for results, the following code works for me in the interactive Python window in ArcMap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;custom_extent = {'XMin':-87.678956, 'XMax':-87.611652, 'YMin':41.867129, 'YMax':41.954932}
newExtent = arcpy.Extent(**custom_extent)

print data_frame.extent.XMin
data_frame.spatialReference = arcpy.SpatialReference("WGS 1984")
print data_frame.extent.XMin

data_frame.extent = newExtent
print data_frame.extent.XMin&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use a dictionary to store an extent's bounds, may I suggest using key names that correspond to function parameters.&amp;nbsp; That way, you can just pass the dictionary as keyword arguments to an Extent function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Update&lt;/EM&gt;:&amp;nbsp; It dawned on me after posting the code above why your original code might not be working.&amp;nbsp; I believe it fails because you change the spatial reference of the data frame &lt;SPAN style="text-decoration: underline;"&gt;after&lt;/SPAN&gt; getting the extent object from the data frame.&amp;nbsp; If you change the spatial reference first, it seems to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;custom_extent = {1:-87.678956, 2: -87.611652, 3:41.867129, 4:41.954932}

print data_frame.extent.XMin
data_frame.spatialReference = arcpy.SpatialReference("WGS 1984")
print data_frame.extent.XMin

newExtent = data_frame.extent
newExtent.XMin, newExtent.XMax = custom_extent[1], custom_extent[2]
newExtent.YMin, newExtent.YMax = custom_extent[3], custom_extent[4]
data_frame.extent = newExtent
print data_frame.extent.XMin&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:43:39 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-12-11T15:43:39Z</dc:date>
    <item>
      <title>Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332095#M25828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to set the following coordinates to a dataframe:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; custom_extent = {1:-87.678956, 2: -87.611652, 3:41.867129, 4:41.954932}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where `1` is key for `XMin`, `2` is key for `XMax`, `3` is key for `YMin`, and `4` is key for `YMax`&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I try to set the new extent up, the coordinates are not the results I expect. Here's a code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print data_frame.extent.XMin&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;&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; # prints 480718.855003&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; original_spatial_reference = data_frame.spatialReference&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newExtent = data_frame.extent&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data_frame.spatialReference = arcpy.SpatialReference("WGS 1984")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print data_frame.extent.XMin&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;&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; # prints -87.6986700746&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newExtent.XMin, newExtent.XMax = custom_extent[1], custom_extent[2]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newExtent.YMin, newExtent.YMax = custom_extent[3], custom_extent[4]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data_frame.extent = newExtent&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;&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; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print data_frame.extent.XMin&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;&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; # prints -93.500018925&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data_frame.spatialReference = original_spatial_reference&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print data_frame.extent.XMin&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;&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; # prints -2.38749449402&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every printout does not match the desired `XMin`: `-87.678956`. Any thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 23:54:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332095#M25828</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2015-02-05T23:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332096#M25829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The extent object normally defines the lower left and then the upper right, check that you have your numbers in the correct order&amp;nbsp; &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001w00000009000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//001w00000009000000"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 00:08:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332096#M25829</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-02-06T00:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332097#M25830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I''m not sure I follow. &lt;/P&gt;&lt;P&gt;When I reorder the dictionary keys in the following lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newExtent.XMin, newExtent.XMax = custom_extent[1], custom_extent[2]&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newExtent.YMin, newExtent.YMax = custom_extent[3], custom_extent[4]&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I still am not seeing satisfactory results. Is this what you are referring to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 00:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332097#M25830</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2015-02-06T00:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332098#M25831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok...not used to seeing extents that way...I have seen that issue before and I had to go into the layer properties and recalculate the extent of the layer manually and in some instances export the file to a new one before the extents in the new coordinate system are updated.&amp;nbsp; It appears that setting the extent object isn't enough and I haven't been able to find an arcpy property/method to update one.&amp;nbsp; I notice this translating coordinates&amp;nbsp; in an arbitrary World mercator projection centered around 0,0 then redefining the coordinate system to a modified transverse mercator shifted by 300,000 in X and 5,100,000 in Y.&amp;nbsp; Oddly, the lower extent was retained (around 0,0) yet the upper was correct.&amp;nbsp; So in short...not definitive answer but you aren't alone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 00:56:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332098#M25831</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-02-06T00:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332099#M25832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's a comment in the documentation for the Extent property of the DataFrame class:&amp;nbsp; "&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;If the aspect ratio of the extent does not match the shape of the data frame, the final extent will be adjusted to fit the new extent within the shape of the data frame. In other words, if you set explicit X, Y coordinates, you may not get the same values returned if you attempt to read them later. "&amp;nbsp; &amp;lt;--&lt;SPAN style="text-decoration: underline;"&gt;I suspect this is what is partly the cause of what's happening.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;A second contributing factor may be the dataFrame object is assigned out of an 'original_spatial_reference' into 'WGS 84' then back into the original spatial reference again. -- although there isn't print out of what the original is.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;Here's my request:&lt;/SPAN&gt; please print out the &lt;STRONG&gt;original_spatial_reference&lt;/STRONG&gt;, the dataframe &lt;STRONG&gt;map units&lt;/STRONG&gt;, and the &lt;STRONG&gt;elementWidth&lt;/STRONG&gt;, &lt;STRONG&gt;elementHeight&lt;/STRONG&gt; at each step in the routine: before you start, during the assignments, and before/after each spatial reference shift. -- The last two properties will let us look at the dataframe aspect ratio which is held constant during the assignment of Mins and Maxs.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;Lastly, while in WGS84, try setting the extent of your MXD by hand using those input values, then shift spatial references back to your original spatial reference and map units, then interrogate the MXD to look for those odd printed out values. (the ones that look like UTM meters and/or decimal degrees.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;Good news is that your custom_extent array and newExtents assignments are formatted correctly; there should be nothing wrong with these.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;Please reply back with what printouts arcpy gives at each step and we'll proceed from there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.1599998474121px;"&gt;Jason S. aka JasonInVegas&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 01:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332099#M25832</guid>
      <dc:creator>JasonSchwartz</dc:creator>
      <dc:date>2015-02-06T01:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332100#M25833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting Jason, but I have experience weird extent behaviour when working solely with arcpy (ie no ArcMap open and no *.mxd referenced).&amp;nbsp; I will try to post a demo when I get off this iThingy and on to my desktop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 01:55:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332100#M25833</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-02-06T01:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332101#M25834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jason - the documentation makes sense in that regard - if the dimensions of the data frame differ from the received coordinates, naturally they're not going to be precise. However, as you know, this goes beyond that problem.&lt;/P&gt;&lt;P&gt;The following printout reflects a set of print statements done prior to every line seen above, with an additional set of print statements following the last line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin 480718.855003&lt;/P&gt;&lt;P&gt;XMax 487765.034905&lt;/P&gt;&lt;P&gt;YMin -897522.367118&lt;/P&gt;&lt;P&gt;YMax -892753.723682&lt;/P&gt;&lt;P&gt;mapUnits Meters&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D2102D8&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin 480718.855003&lt;/P&gt;&lt;P&gt;XMax 487765.034905&lt;/P&gt;&lt;P&gt;YMin -897522.367118&lt;/P&gt;&lt;P&gt;YMax -892753.723682&lt;/P&gt;&lt;P&gt;mapUnits Meters&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D210428&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin 480718.855003&lt;/P&gt;&lt;P&gt;XMax 487765.034905&lt;/P&gt;&lt;P&gt;YMin -897522.367118&lt;/P&gt;&lt;P&gt;YMax -892753.723682&lt;/P&gt;&lt;P&gt;mapUnits Meters&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D210410&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin -87.6986889715&lt;/P&gt;&lt;P&gt;XMax -87.6353211223&lt;/P&gt;&lt;P&gt;YMin 41.9155057359&lt;/P&gt;&lt;P&gt;YMax 41.9583911976&lt;/P&gt;&lt;P&gt;mapUnits DecimalDegrees&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D210410&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin -87.6986889715&lt;/P&gt;&lt;P&gt;XMax -87.6353211223&lt;/P&gt;&lt;P&gt;YMin 41.9155057359&lt;/P&gt;&lt;P&gt;YMax 41.9583911976&lt;/P&gt;&lt;P&gt;mapUnits DecimalDegrees&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D210410&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin -93.500046392&lt;/P&gt;&lt;P&gt;XMax -93.4999395774&lt;/P&gt;&lt;P&gt;YMin 50.1891561644&lt;/P&gt;&lt;P&gt;YMax 50.1892284534&lt;/P&gt;&lt;P&gt;mapUnits DecimalDegrees&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D210410&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XMin -5.44407670288&lt;/P&gt;&lt;P&gt;XMax 6.44407996557&lt;/P&gt;&lt;P&gt;YMin -0.0228719610641&lt;/P&gt;&lt;P&gt;YMax 8.02267627373&lt;/P&gt;&lt;P&gt;mapUnits Meters&lt;/P&gt;&lt;P&gt;spatialReference &amp;lt;geoprocessing spatial reference object object at 0x0D210410&amp;gt;&lt;/P&gt;&lt;P&gt;elementWidth 13.6918&lt;/P&gt;&lt;P&gt;elementHeight 9.2662&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try setting the extent manually tomorrow when I have more time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 02:15:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332101#M25834</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2015-02-06T02:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332102#M25835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I appreciate your help in all of this. I also tend to see differences in result when I'm using ArcPy with mxd set as "CURRENT" vs running ArcPy via a standalone script. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 02:17:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332102#M25835</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2015-02-06T02:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332103#M25836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Ben, this looks just like you described (and baffling to me.)&amp;nbsp; Can you sub-qurey into the spatialReference object&amp;nbsp; to printout more than the in-memory Object handle?&amp;nbsp; The goods (i.e. reason for this madness) may be contained therein.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How about including these properties: sO.projectionname; GCSname; linearunitcode &amp;lt;-- that one may be the key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 17:07:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332103#M25836</guid>
      <dc:creator>JasonSchwartz1</dc:creator>
      <dc:date>2015-02-28T17:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332104#M25837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Jason, I've pretty much given up this approach in favor of a roundabout method of setting the dataframe extent by zooming to selected features. Perhaps I'll go about doing a printout of those properties at some point down the road, but for the time being, I've moved on to other things (partially out of frustration, and partially out of time constraints).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm shocked that something so simple could be such a challenge to implement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 18:04:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332104#M25837</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2015-02-28T18:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in projection while defining data frame extent by coordinates</title>
      <link>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332105#M25838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try building the Extent object from scratch instead of reconstructing one you get from the DataFrame object.&amp;nbsp; If I understand what you are expecting for results, the following code works for me in the interactive Python window in ArcMap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;custom_extent = {'XMin':-87.678956, 'XMax':-87.611652, 'YMin':41.867129, 'YMax':41.954932}
newExtent = arcpy.Extent(**custom_extent)

print data_frame.extent.XMin
data_frame.spatialReference = arcpy.SpatialReference("WGS 1984")
print data_frame.extent.XMin

data_frame.extent = newExtent
print data_frame.extent.XMin&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use a dictionary to store an extent's bounds, may I suggest using key names that correspond to function parameters.&amp;nbsp; That way, you can just pass the dictionary as keyword arguments to an Extent function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Update&lt;/EM&gt;:&amp;nbsp; It dawned on me after posting the code above why your original code might not be working.&amp;nbsp; I believe it fails because you change the spatial reference of the data frame &lt;SPAN style="text-decoration: underline;"&gt;after&lt;/SPAN&gt; getting the extent object from the data frame.&amp;nbsp; If you change the spatial reference first, it seems to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;custom_extent = {1:-87.678956, 2: -87.611652, 3:41.867129, 4:41.954932}

print data_frame.extent.XMin
data_frame.spatialReference = arcpy.SpatialReference("WGS 1984")
print data_frame.extent.XMin

newExtent = data_frame.extent
newExtent.XMin, newExtent.XMax = custom_extent[1], custom_extent[2]
newExtent.YMin, newExtent.YMax = custom_extent[3], custom_extent[4]
data_frame.extent = newExtent
print data_frame.extent.XMin&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issues-in-projection-while-defining-data-frame/m-p/332105#M25838</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T15:43:39Z</dc:date>
    </item>
  </channel>
</rss>

