<?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 How to write a script that will define missing spatial ref in a fc to match the rest of the fc in a .gdb in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105203#M62585</link>
    <description>&lt;P&gt;I am taking my first Python and and it's all online and I am struggle to say the list. I have watched videos and read blogs and I haven't been able to get the slightest idea of how to do this. I have a .gbd that has 4 feature class (shapefiles) in it. My first task was to write a script that read all the spatial reference and I got that&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;arcpy.env.workspace = "C:/Users/morganp/Documents/NOTES/msu/LM 7/GrPrg_lab7data"&lt;BR /&gt;feature_classes = arcpy.ListFeatureClasses()&lt;BR /&gt;for fc in feature_classes:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; spatial_ref = arcpy.Describe(fc).spatialReference&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if spatial_ref.name == "Unknown":&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("{} has an unknown spatial reference".format(fc))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("{} : {}".format(fc, spatial_ref.name))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My second task is to write a script that will set the one that has the unknown spatial reference to match the others&lt;/P&gt;&lt;P&gt;I am using IDLE Python 2.7 and ArcMap 10.7&lt;/P&gt;&lt;P&gt;Many thanks for all help&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 15:15:08 GMT</pubDate>
    <dc:creator>PatrickMorgan39339</dc:creator>
    <dc:date>2021-10-06T15:15:08Z</dc:date>
    <item>
      <title>How to write a script that will define missing spatial ref in a fc to match the rest of the fc in a .gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105203#M62585</link>
      <description>&lt;P&gt;I am taking my first Python and and it's all online and I am struggle to say the list. I have watched videos and read blogs and I haven't been able to get the slightest idea of how to do this. I have a .gbd that has 4 feature class (shapefiles) in it. My first task was to write a script that read all the spatial reference and I got that&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;arcpy.env.workspace = "C:/Users/morganp/Documents/NOTES/msu/LM 7/GrPrg_lab7data"&lt;BR /&gt;feature_classes = arcpy.ListFeatureClasses()&lt;BR /&gt;for fc in feature_classes:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; spatial_ref = arcpy.Describe(fc).spatialReference&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if spatial_ref.name == "Unknown":&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("{} has an unknown spatial reference".format(fc))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("{} : {}".format(fc, spatial_ref.name))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My second task is to write a script that will set the one that has the unknown spatial reference to match the others&lt;/P&gt;&lt;P&gt;I am using IDLE Python 2.7 and ArcMap 10.7&lt;/P&gt;&lt;P&gt;Many thanks for all help&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 15:15:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105203#M62585</guid>
      <dc:creator>PatrickMorgan39339</dc:creator>
      <dc:date>2021-10-06T15:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script that will define missing spatial ref in a fc to match the rest of the fc in a .gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105217#M62586</link>
      <description>&lt;P&gt;Perhaps the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/define-projection.htm" target="_self"&gt;DefineProjection API&lt;/A&gt; will do the trick.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 15:40:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105217#M62586</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-10-06T15:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a script that will define missing spatial ref in a fc to match the rest of the fc in a .gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105231#M62587</link>
      <description>&lt;P&gt;Thanks I actually found that page about 5 minutes after posting the question. Still working it out!!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 16:19:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-write-a-script-that-will-define-missing/m-p/1105231#M62587</guid>
      <dc:creator>PatrickMorgan39339</dc:creator>
      <dc:date>2021-10-06T16:19:29Z</dc:date>
    </item>
  </channel>
</rss>

