<?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 Arcpy select by location in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880917#M676</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm running arcpy and trying to populate my parcel layer with the district name it falls in.&amp;nbsp; I can manually populate the column by using 'select by location' and then copying the district name from the district layer and calculating the selected values in the parcels.&amp;nbsp; Is there a way to automate this in arcpy?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Feb 2018 17:12:39 GMT</pubDate>
    <dc:creator>MikeJones7</dc:creator>
    <dc:date>2018-02-27T17:12:39Z</dc:date>
    <item>
      <title>Arcpy select by location</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880917#M676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm running arcpy and trying to populate my parcel layer with the district name it falls in.&amp;nbsp; I can manually populate the column by using 'select by location' and then copying the district name from the district layer and calculating the selected values in the parcels.&amp;nbsp; Is there a way to automate this in arcpy?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 17:12:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880917#M676</guid>
      <dc:creator>MikeJones7</dc:creator>
      <dc:date>2018-02-27T17:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy select by location</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880918#M677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at Spatial Join:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm"&gt;Spatial Join—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should allow you to define the parameters for doing exactly what you are looking for. The caveat is that this will create a new feature class so you'd need to overwrite your parcel dataset with the result or create an in_memory feature class, join it your original parcels dataset, and update your original district attribute using a field calculator function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 17:23:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880918#M677</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2018-02-27T17:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy select by location</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880919#M678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good thought, but I need to keep my existing feature classes.&amp;nbsp; I can't create new outputs.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 17:28:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880919#M678</guid>
      <dc:creator>MikeJones7</dc:creator>
      <dc:date>2018-02-27T17:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy select by location</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880920#M679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case I would recommend creating your output in the&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/the-in-memory-workspace.htm" title="http://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/the-in-memory-workspace.htm"&gt;in_memory workspac&lt;/A&gt;e. You should then be able to join that result to your original parcel layer using a unique parcel ID, then update your District field using calculate field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm"&gt;Calculate Field—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2018 17:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880920#M679</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2018-02-27T17:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy select by location</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880921#M680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's what I came up with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.MakeFeatureLayer_management(Parcels,"ParcelLayer")&lt;/P&gt;&lt;P&gt;def spJoin(dataName,DistrictColumn,ParcelColumn):&lt;BR /&gt; arcpy.SpatialJoin_analysis(target_features = Parcels, join_features = dataName,out_feature_class = "TempJoin")&lt;BR /&gt; print dataName + " joined with a spatial join"&lt;BR /&gt; arcpy.MakeFeatureLayer_management("TempJoin","TempJoinLayer")&lt;BR /&gt; arcpy.AddJoin_management(in_layer_or_view="ParcelLayer", in_field="PARCEL_ID", join_table="TempJoinLayer", join_field="PARCEL_ID", join_type="KEEP_ALL")&lt;BR /&gt; print "Join on table"&lt;BR /&gt; expression = '!TempJoin.{0}!.title()'.format(DistrictColumn) &lt;BR /&gt; print expression&lt;BR /&gt; arcpy.CalculateField_management("ParcelLayer","TaxParcel."+ParcelColumn, expression, expression_type="PYTHON_9.3", code_block="")&lt;BR /&gt; print "Calcualted Field for "+ dataName&lt;BR /&gt; arcpy.RemoveJoin_management("ParcelLayer")&lt;BR /&gt; print "Join Removed"&lt;BR /&gt; arcpy.DeleteFeatures_management("TempJoin")&lt;BR /&gt; print "Temp File is Joined"&lt;/P&gt;&lt;P&gt;#spJoin(DATANAME,COLUMN YOU WANT TO MOVE, COLUMN IN THE DESTINATION)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2018 16:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-select-by-location/m-p/880921#M680</guid>
      <dc:creator>MikeJones7</dc:creator>
      <dc:date>2018-03-01T16:45:48Z</dc:date>
    </item>
  </channel>
</rss>

