<?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: arcpy change data frame coordinate system in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433524#M4696</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the path created by our Arc install:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;prjPath = "C:/Program Files(x86)/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;prjFile = prjPath + "NAD 1983 UTM Zone 10N.prj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(prjFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last statement causes a run-time error. I recreated that path as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"C:/My Program Files(x86)/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and it works fine. The only difference I can think of is that the original "Program Files(x86)" folder is read-only where my "My Program Files(x86)" folder is read-write.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Jan 2011 19:00:59 GMT</pubDate>
    <dc:creator>ScottOatley</dc:creator>
    <dc:date>2011-01-17T19:00:59Z</dc:date>
    <item>
      <title>arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433521#M4693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a tool that allows a user to zoom to a township/range for anywhere in the Western US... My data frame is in GCS NAD1983, but depending on where the user zooms, I want the data frame to reproject to a specific UTM Zone depending on where the township/range is located.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've played with the spatialReference class, but no luck yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 20:02:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433521#M4693</guid>
      <dc:creator>RyanKelley</dc:creator>
      <dc:date>2010-08-25T20:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433522#M4694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I guess I posted my question too soon...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;prjFile = prjPath + "/" + "NAD 1983 UTM Zone 10N.prj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(prjFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for DF in MAP.ListDataFrames(MXD):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DF.spatialReference = sr&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 21:40:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433522#M4694</guid>
      <dc:creator>RyanKelley</dc:creator>
      <dc:date>2010-08-25T21:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433523#M4695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm getting a runtime error when trying this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;prjFile = prjPath + "/" + "NAD 1983 UTM Zone 10N.prj"
sr = arcpy.SpatialReference(prjFile)&amp;nbsp; &amp;lt;--- runtime error 999999
for DF in MAP.ListDataFrames(MXD):
DF.spatialReference = sr &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm just entering this one line at a time in the python command line window as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;prjPath = "C:/Program Files .../"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;prjFile = prjPath + "NAD 1983 UTM Zone 10N.prj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;df = arcpy.mapping.ListDataFrames(mxd)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(prjFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then get the runtime error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I missing something, or does this not work with "CURRENT", or by entering one line at a time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:28:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433523#M4695</guid>
      <dc:creator>ScottOatley</dc:creator>
      <dc:date>2021-12-12T16:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433524#M4696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the path created by our Arc install:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;prjPath = "C:/Program Files(x86)/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;prjFile = prjPath + "NAD 1983 UTM Zone 10N.prj"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(prjFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last statement causes a run-time error. I recreated that path as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"C:/My Program Files(x86)/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and it works fine. The only difference I can think of is that the original "Program Files(x86)" folder is read-only where my "My Program Files(x86)" folder is read-write.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 19:00:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433524#M4696</guid>
      <dc:creator>ScottOatley</dc:creator>
      <dc:date>2011-01-17T19:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433525#M4697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I get this error from time to time for a variety of tasks within a script... but I only seem to get it when running something in the ArcPy window in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Usually I just re-start ArcMap and everything is totally fine.&amp;nbsp; Why this happens... ???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Feb 2011 20:49:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433525#M4697</guid>
      <dc:creator>RyanKelley</dc:creator>
      <dc:date>2011-02-07T20:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433526#M4698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;This is the path created by our Arc install:&lt;BR /&gt;&lt;BR /&gt;prjPath = "C:/Program Files(x86)/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/"&lt;BR /&gt;&lt;BR /&gt;prjFile = prjPath + "NAD 1983 UTM Zone 10N.prj"&lt;BR /&gt;sr = arcpy.SpatialReference(prjFile)&lt;BR /&gt;&lt;BR /&gt;The last statement causes a run-time error. I recreated that path as:&lt;BR /&gt;&lt;BR /&gt;"C:/My Program Files(x86)/ArcGIS/Desktop10.0/Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/"&lt;BR /&gt;&lt;BR /&gt;and it works fine. The only difference I can think of is that the original "Program Files(x86)" folder is read-only where my "My Program Files(x86)" folder is read-write.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Scott&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Figured this out. I missed a space in the original path. It's between "Files" and "(x86)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 21:07:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433526#M4698</guid>
      <dc:creator>ScottOatley</dc:creator>
      <dc:date>2011-02-08T21:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433527#M4699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I'm getting a runtime error when trying this.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;prjFile = prjPath + "/" + "NAD 1983 UTM Zone 10N.prj"
sr = arcpy.SpatialReference(prjFile)&amp;nbsp; &lt;SPAN style="color:&amp;quot;Red&amp;quot;;"&gt;&amp;lt;--- runtime error 999999&lt;/SPAN&gt;
for DF in MAP.ListDataFrames(MXD):
DF.spatialReference = sr &lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;I'm just entering this one line at a time in the python command line window as follows:&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;import arcpy&amp;nbsp; &lt;BR /&gt;prjPath = "C:/Program Files .../"&amp;nbsp; &lt;BR /&gt;prjFile = prjPath + "NAD 1983 UTM Zone 10N.prj"&amp;nbsp; &lt;BR /&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&amp;nbsp; &lt;BR /&gt;df = arcpy.mapping.ListDataFrames(mxd)[0]&amp;nbsp; &lt;BR /&gt;sr = arcpy.SpatialReference(prjFile)&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Then get the runtime error.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Am I missing something, or does this not work with "CURRENT", or by entering one line at a time?&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Thanks,&amp;nbsp; &lt;BR /&gt;Scott&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you explain a little further how this works? I haven't been able to figure out what I am missing to get this to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433527#M4699</guid>
      <dc:creator>MarkJames</dc:creator>
      <dc:date>2021-12-11T19:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy change data frame coordinate system</title>
      <link>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433528#M4700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The issues identified earlier in this post were paths with typos.&amp;nbsp; It is extremely important to get the paths correct.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As a simple test, I browsed to a PRJ file in the ArcGIS coordinate systems folder.&amp;nbsp; Here is a trick.&amp;nbsp; Hold down the SHIFT key and right-click on a file.&amp;nbsp; Then select "Copy as Path" from the context menu.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I opened a new map document and the Python window.&amp;nbsp; I typed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(r&amp;nbsp; then I clicked Ctrl-V)&amp;nbsp; the result looked like&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sr = arcpy.SpatialReference(r"C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\UTM\NAD 1983\NAD 1983 UTM Zone 10N.prj")&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.spatialReference = sr&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are still having complications, please post your code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:27:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/arcpy-change-data-frame-coordinate-system/m-p/433528#M4700</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-11T19:27:22Z</dc:date>
    </item>
  </channel>
</rss>

