<?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: Copy a field from one feature class to another without creating a new feature cla in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-a-field-from-one-feature-class-to-another/m-p/687029#M53194</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This worked for me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Create new field mappings and addd both feature classes&amp;nbsp; fieldmappings = arcpy.FieldMappings() fieldmappings.addTable(Input_Polygons) fieldmappings.addTable(Counties)&amp;nbsp; # create output feature for spatial join outstewardshipcounties = os.path.join(arcpy.env.scratchGDB, "StewardshipCounties")&amp;nbsp; #run spatial joint tool&amp;nbsp; arcpy.SpatialJoin_analysis(Input_Polygons, Counties, outstewardshipcounties , "#", "#", fieldmappings, "HAVE_THEIR_CENTER_IN")&amp;nbsp; #create dictionary&amp;nbsp; path_dict = { } rows = arcpy.SearchCursor(outstewardshipcounties) for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; keyrow = row.getValue("ObjectID") &amp;nbsp;&amp;nbsp;&amp;nbsp; valrow = row.getValue("FIPS_TXT") &amp;nbsp;&amp;nbsp;&amp;nbsp; path_dict[keyrow] = valrow&amp;nbsp; urows = arcpy.UpdateCursor(Input_Polygons) for urow in urows: &amp;nbsp;&amp;nbsp;&amp;nbsp; upkey = urow.getValue("ObjectID") &amp;nbsp;&amp;nbsp;&amp;nbsp; if upkey in path_dict: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urow.setValue("County", path_dict[upkey]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urows.updateRow(urow) del row, rows, urow, urows&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2013 13:46:34 GMT</pubDate>
    <dc:creator>ionarawilson1</dc:creator>
    <dc:date>2013-10-10T13:46:34Z</dc:date>
    <item>
      <title>Copy a field from one feature class to another without creating a new feature class?</title>
      <link>https://community.esri.com/t5/python-questions/copy-a-field-from-one-feature-class-to-another/m-p/687028#M53193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to copy a field from one feature class to another without creating a new feature class? Is it possible to do that, perhaps using the Search and Update Cursor? Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 12:52:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-a-field-from-one-feature-class-to-another/m-p/687028#M53193</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-10T12:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Copy a field from one feature class to another without creating a new feature cla</title>
      <link>https://community.esri.com/t5/python-questions/copy-a-field-from-one-feature-class-to-another/m-p/687029#M53194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This worked for me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Create new field mappings and addd both feature classes&amp;nbsp; fieldmappings = arcpy.FieldMappings() fieldmappings.addTable(Input_Polygons) fieldmappings.addTable(Counties)&amp;nbsp; # create output feature for spatial join outstewardshipcounties = os.path.join(arcpy.env.scratchGDB, "StewardshipCounties")&amp;nbsp; #run spatial joint tool&amp;nbsp; arcpy.SpatialJoin_analysis(Input_Polygons, Counties, outstewardshipcounties , "#", "#", fieldmappings, "HAVE_THEIR_CENTER_IN")&amp;nbsp; #create dictionary&amp;nbsp; path_dict = { } rows = arcpy.SearchCursor(outstewardshipcounties) for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; keyrow = row.getValue("ObjectID") &amp;nbsp;&amp;nbsp;&amp;nbsp; valrow = row.getValue("FIPS_TXT") &amp;nbsp;&amp;nbsp;&amp;nbsp; path_dict[keyrow] = valrow&amp;nbsp; urows = arcpy.UpdateCursor(Input_Polygons) for urow in urows: &amp;nbsp;&amp;nbsp;&amp;nbsp; upkey = urow.getValue("ObjectID") &amp;nbsp;&amp;nbsp;&amp;nbsp; if upkey in path_dict: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urow.setValue("County", path_dict[upkey]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urows.updateRow(urow) del row, rows, urow, urows&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 13:46:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-a-field-from-one-feature-class-to-another/m-p/687029#M53194</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-10T13:46:34Z</dc:date>
    </item>
  </channel>
</rss>

