<?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: Processinging Joined tables with Python in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284746#M68643</link>
    <description>&lt;LI-CODE lang="python"&gt;# add the spatial join, store the result layer in a variable
joined_layer = arcpy.management.AddSpatialJoin("BuildingFootprintsCE", "landuse","JOIN_ONE_TO_ONE", "KEEP_ALL")[0]

# get the join name from the layer's attributes
join_name = joined_layer.connectionProperties["destination"]["dataset"]
print(f"join name: {join_name}")

# do the calculation
expression = f"!{join_name}.type!.title()"
print(f"expression: {expression}")
arcpy.management.CalculateField("BuildingFootprintsCE", "BuildingFootprintsCE.type", expression, "PYTHON3")

# remove the join
arcpy.management.RemoveJoin("BuildingFootprintsCE", join_name)&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 02 May 2023 14:54:28 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-05-02T14:54:28Z</dc:date>
    <item>
      <title>Processinging Joined tables with Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284711#M68640</link>
      <description>&lt;P&gt;I'm trying to get started with using Python to automate some tasks I'll be needing to do regularly...&amp;nbsp; so far it hasn't been too difficult but this one has me stumped.&lt;/P&gt;&lt;P&gt;I'm trying to process some OSM data, and creating a Spatial Join between the Building Footprints and Landuse.&amp;nbsp; Then I want to copy a field from Landuse over and process it a bit, finally remove the join(which may not really be necessary here but I'd like to know how)&lt;/P&gt;&lt;P&gt;The problem I'm running into is the Spatial Join creates a new name for itself each time its run, and I'm not sure how to access that name to copy the table attribute over let alone remove the join.&amp;nbsp; Here's what I have so far.&amp;nbsp; In this case, the joins name is now BuildingFootprintsCE_AddSpatialJoin_2, and it increases in value each time it is run.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.AddSpatialJoin(
target_features="BuildingFootprintsCE",
join_features="landuse",
join_operation="JOIN_ONE_TO_ONE",
join_type="KEEP_ALL",
field_mapping=r'osm_id "osm_id" true true false 11 Double 0 11,First,#,C:\Visual\Area\US_Fort-Lauderdale\GIS\shape\landuse.shp,osm_id,-1,-1;name "name" true true false 48 Text 0 0,First,#,C:\Visual\Area\US_Fort-Lauderdale\GIS\shape\landuse.shp,name,0,48;type "type" true true false 16 Text 0 0,First,#,C:\Visual\Area\US_Fort-Lauderdale\GIS\shape\landuse.shp,type,0,16',
match_option="INTERSECT",
search_radius=None,
distance_field_name=""
)
arcpy.management.CalculateField(
in_table="BuildingFootprintsCE",
field="BuildingFootprintsCE.type",
expression="!BuildingFootprintsCE_AddSpatialJoin_1.type!.title()",
expression_type="PYTHON3",
code_block="",
field_type="TEXT",
enforce_domains="NO_ENFORCE_DOMAINS"
)

arcpy.management.RemoveJoin(
in_layer_or_view="BuildingFootprintsCE",
join_name="BuildingFootprintsCE_AddSpatialJoin_2"
)&lt;/LI-CODE&gt;&lt;P&gt;Would appreciate any assistance...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 14:18:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284711#M68640</guid>
      <dc:creator>MatthewHyner</dc:creator>
      <dc:date>2023-05-02T14:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Processinging Joined tables with Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284746#M68643</link>
      <description>&lt;LI-CODE lang="python"&gt;# add the spatial join, store the result layer in a variable
joined_layer = arcpy.management.AddSpatialJoin("BuildingFootprintsCE", "landuse","JOIN_ONE_TO_ONE", "KEEP_ALL")[0]

# get the join name from the layer's attributes
join_name = joined_layer.connectionProperties["destination"]["dataset"]
print(f"join name: {join_name}")

# do the calculation
expression = f"!{join_name}.type!.title()"
print(f"expression: {expression}")
arcpy.management.CalculateField("BuildingFootprintsCE", "BuildingFootprintsCE.type", expression, "PYTHON3")

# remove the join
arcpy.management.RemoveJoin("BuildingFootprintsCE", join_name)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 May 2023 14:54:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284746#M68643</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-05-02T14:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Processinging Joined tables with Python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284753#M68647</link>
      <description>&lt;P&gt;Thankyou!&amp;nbsp; Blew my mind for a few minutes, but I think I see what's going on here now.&amp;nbsp; Messed with Python and controlling a raspberry pi a ways back...trying to apply it to ArcGIS now.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 15:25:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/processinging-joined-tables-with-python/m-p/1284753#M68647</guid>
      <dc:creator>MatthewHyner</dc:creator>
      <dc:date>2023-05-02T15:25:17Z</dc:date>
    </item>
  </channel>
</rss>

