<?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: Clear Data Frame Projection in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117211#M9198</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This should theoretically do it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;undefinedSr = arcpy.SpatialReference() #Note this DOES NOT make a 'Unknown' SR obj, see below
mxd = r"C:\temp\my_mxd.mxd"
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp; df.spatialReference = undefinedSr
mxd.save()
del mxd&lt;/PRE&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I found this is actually a bit more difficult.... The trick is to get a SR object to be of a "Unknown" coordinate system. The only way I could do this was to run the DefineProjection tool, and manually clear out the 'Coordinate System' parameter - which makes its value then default to a magic value called &lt;/SPAN&gt;&lt;STRONG&gt;Unknown&lt;/STRONG&gt;&lt;SPAN&gt; (note this is NOT a string value of "Unknown", but something else). Once I had a FC defined with an Unknown SR, then:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;undefinedSr = arcpy.Describe(unknownSrFC).spatialReference
mxd = r"C:\temp\my_mxd.mxd"
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp; df.spatialReference = undefinedSr
mxd.save()
del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Which worked...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone know a better way to create an Unknown spatial reference object?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tried all these, which do not work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;undefinedSr = arcpy.SpatialReference(None) 
undefinedSr = arcpy.SpatialReference(0) 
undefinedSr = arcpy.SpatialReference("Unknown")
undefinedSr = arcpy.SpatialReference(Unknown) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like there should be a EPSG code for Unknown/Undefined, but I can't find it...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:53:20 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2021-12-11T06:53:20Z</dc:date>
    <item>
      <title>Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117210#M9197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How would I use Python to clear the data frame projection in ArcMap?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Patrick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 20:27:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117210#M9197</guid>
      <dc:creator>PatrickYoung</dc:creator>
      <dc:date>2013-06-12T20:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117211#M9198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This should theoretically do it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;undefinedSr = arcpy.SpatialReference() #Note this DOES NOT make a 'Unknown' SR obj, see below
mxd = r"C:\temp\my_mxd.mxd"
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp; df.spatialReference = undefinedSr
mxd.save()
del mxd&lt;/PRE&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I found this is actually a bit more difficult.... The trick is to get a SR object to be of a "Unknown" coordinate system. The only way I could do this was to run the DefineProjection tool, and manually clear out the 'Coordinate System' parameter - which makes its value then default to a magic value called &lt;/SPAN&gt;&lt;STRONG&gt;Unknown&lt;/STRONG&gt;&lt;SPAN&gt; (note this is NOT a string value of "Unknown", but something else). Once I had a FC defined with an Unknown SR, then:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;undefinedSr = arcpy.Describe(unknownSrFC).spatialReference
mxd = r"C:\temp\my_mxd.mxd"
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp; df.spatialReference = undefinedSr
mxd.save()
del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Which worked...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone know a better way to create an Unknown spatial reference object?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tried all these, which do not work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;undefinedSr = arcpy.SpatialReference(None) 
undefinedSr = arcpy.SpatialReference(0) 
undefinedSr = arcpy.SpatialReference("Unknown")
undefinedSr = arcpy.SpatialReference(Unknown) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like there should be a EPSG code for Unknown/Undefined, but I can't find it...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:53:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117211#M9198</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T06:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117212#M9199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;BR /&gt;Anyone know a better way to create an Unknown spatial reference object?&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
sr = arcpy.SpatialReference()
sr = sr.loadFromString('{B286C06B-0879-11D2-AACA-00C04FA33C20}')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That should create a proper 'unknown' spatial reference object. &lt;/SPAN&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDg3MDMz" rel="nofollow noopener noreferrer" target="_blank"&gt;Source bug report&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:53:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117212#M9199</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-12-11T06:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117213#M9200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; unknownSr = arcpy.SpatialReference()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; unknownSr.loadFromString('{B286C06B-0879-11D2-AACA-00C04FA33C20}')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; unknownSr.name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Unknown'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Works great!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nothing says Unknown coordinate system like '{B286C06B-0879-11D2-AACA-00C04FA33C20}'...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 15:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117213#M9200</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-06-13T15:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117214#M9201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Nothing says Unknown coordinate system like '{B286C06B-0879-11D2-AACA-00C04FA33C20}'...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I agree. You can pull out these class ID values from the bin/XMLSupport.dat file within your installation directory, but it'd be nice to have a 'named' way to create an unknown coordinate system. I've submitted an enhancement request on the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 22:20:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117214#M9201</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2013-06-13T22:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117215#M9202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for this info, though I'm having an issue with this as it doesn't appear to play well with arcpy.DefineProjection_management(p,newSpatialReference). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
newSpatialReference = arcpy.SpatialReference()
newSpatialReference = newSpatialReference.loadFromString('{B286C06B-0879-11D2-AACA-00C04FA33C20}')

def clearSR():

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Copy FC's to the new database
&amp;nbsp;&amp;nbsp;&amp;nbsp; dsList = arcpy.ListDatasets()
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcList = arcpy.ListFeatureClasses()
&amp;nbsp;&amp;nbsp;&amp;nbsp; projectList = dsList + fcList

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Project the datasets and featureclasses and write to target db
&amp;nbsp;&amp;nbsp;&amp;nbsp; for p in projectList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('Defining Spatial Reference for {0}'.format(p))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DefineProjection_management(p,newSpatialReference)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:53:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117215#M9202</guid>
      <dc:creator>JonPedder</dc:creator>
      <dc:date>2021-12-11T06:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117216#M9203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;“&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;arcpy.DefineProjection_management(p,newSpatialReference)&amp;nbsp; ”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;This is error in arcgis 10.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000622: Failed to execute (Define Projection). Parameters are not valid.&lt;/P&gt;&lt;P&gt;ERROR 000628: Cannot set input into parameter coor_system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2015 07:20:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117216#M9203</guid>
      <dc:creator>JoeZhou1</dc:creator>
      <dc:date>2015-03-20T07:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117217#M9204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jon and Joe,​&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason your code doesn't work is your second line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;newSpatialReference = newSpatialReference.loadFromString('{B286C06B-0879-11D2-AACA-00C04FA33C20}') &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is setting newSpatialReference to the return value of the loadFromString function.&lt;/P&gt;&lt;P&gt;But loadFromString doesn't return anything, it sets the calling object value, so you have a None value&lt;/P&gt;&lt;P&gt;for the rest of your script, which Define projection doesn't like. To unset projection, just call loadFromString:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;newSpatialReference = arcpy.SpatialReference()
newSpatialReference.loadFromString('{B286C06B-0879-11D2-AACA-00C04FA33C20}')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That will create the object, then assign the value with loadFromString. I tested it and it works fine with DefineProjection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Shaun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117217#M9204</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-12-11T06:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Clear Data Frame Projection</title>
      <link>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117218#M9205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Test OK！&lt;/P&gt;&lt;P&gt;Thank you very much！&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 06:22:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clear-data-frame-projection/m-p/117218#M9205</guid>
      <dc:creator>JoeZhou1</dc:creator>
      <dc:date>2015-04-09T06:22:50Z</dc:date>
    </item>
  </channel>
</rss>

