<?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: Trouble with selecting features by location using arcpy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741025#M57297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand your workflow much better now. It sounds like you want to transfer attributes from a polygon layer to the point layers that fall within it, where the corresponding attributes (although they are named differently) are null. Using search cursors may be feasible, but I think using a spatial join will be easier, especially if you have lots and lots of points in each layer. Nested cursors are pretty slow to run, sadly. Here's what I'd recommend:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;After line 4 below, use the where clause parameter of the Make Feature Layer tool to create a feature layer only where the relevant attribute ("LANDDISTRICT" is it?) is null&lt;/LI&gt;&lt;LI&gt;Run a&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm"&gt;Spatial Join&lt;/A&gt;&amp;nbsp;with your point feature layer as the target features, your polygon feature layer as the join features, and an output feature class in the in_memory workspace&lt;/LI&gt;&lt;LI&gt;Use the Add Join tool to join your output point features back to your original point feature layer - the OIDs should be a correct match.&lt;/LI&gt;&lt;LI&gt;Use the Calculate Field tool to update the null values&amp;nbsp;with the values from the polygon layer.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2019 14:22:10 GMT</pubDate>
    <dc:creator>MicahBabinski</dc:creator>
    <dc:date>2019-10-04T14:22:10Z</dc:date>
    <item>
      <title>Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741013#M57285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am trying to figure out how to get the date for a selected feature using the spatial location using arcpy. I keep running into an issue where the MakeFeatureLayer keeps returning an error and I am not sure as to why. I followed several examples and yet I still keep getting an error. I would greatly appreciate any help with this.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os

workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'Database Connections\Some Connection.sde'&lt;/SPAN&gt;
fcs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
walk &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Walk&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; datatype&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FeatureClass"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

Dist_LL &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Database Connections\Some.sde\FeatureClass"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; dirnames&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filenames &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; walk&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; filename &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; filenames&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        fcs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    geometryType &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shapeType
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; geometryType
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; geometryType &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Point'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

        &lt;SPAN class="comment token"&gt;#Get feature class name&lt;/SPAN&gt;
        fcsname &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;basename&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;splitext&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fcsname&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        y &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; name&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;lstrip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'.'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; y

        &lt;SPAN class="comment token"&gt;#For fields in some feature classes&lt;/SPAN&gt;
        fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"OID@"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LANDDISTRICT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LANDLOT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

        &lt;SPAN class="comment token"&gt;#Make feature layers&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'fc'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Dist_LL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Dist_LL'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        
        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'INTERSECT'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Dist_LL_lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                select_records &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Dist_LL_lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; select_records
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; row
            &lt;SPAN class="keyword token"&gt;elif&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; row
            &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;continue&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:32:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741013#M57285</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-12-12T07:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741014#M57286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And the error message is?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 18:37:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741014#M57286</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2019-10-03T18:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741015#M57287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Randy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the error message that I receive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "U:\Models_Tools\Scripts related to Landlot and District\Populate Landlot and District.py", line 17, in &amp;lt;module&amp;gt;&lt;BR /&gt; arcpy.MakeFeatureLayer(fc, 'fc_layer')&lt;BR /&gt;AttributeError: 'module' object has no attribute 'MakeFeatureLayer'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 18:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741015#M57287</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-10-03T18:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741016#M57288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gotta include the '_management' bit to get the proper syntax. See the examples:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/make-feature-layer.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/make-feature-layer.htm"&gt;Make Feature Layer—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 19:34:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741016#M57288</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2019-10-03T19:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741017#M57289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Micah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't believe something that simple had slipped past me. I will make those changes and see if that fixes the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 19:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741017#M57289</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-10-03T19:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741018#M57290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No worries - I've made that error many times (especially when I haven't got adequate sleep, which is often). Pro tip: use the Python window in ArcMap/Pro or an IDE&amp;nbsp;that offers some code completion to check your syntax if you are unsure.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/461047_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 19:45:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741018#M57290</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2019-10-03T19:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741019#M57291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again Micah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made the necessary changes but now I have an issue where the number of returned features exceeds that of the queried features. I am trying to figure out what is the best approach to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Identify&amp;nbsp;the intersecting features in the&amp;nbsp;layer(using the select layer by location)&lt;/LI&gt;&lt;LI&gt;Get the selected&amp;nbsp;records for the fields in the feature layer&lt;/LI&gt;&lt;LI&gt;Using the&amp;nbsp;selected records in that layer, populate the null fields in the other existing layer.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what I am trying to do is basically extract values spatially from one feature and using those values to populate the null fields in another layer. It seemed simple enough, but for some reason it returns an inordinate amount of records, which exceeds that of the queried records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the best way to script this? I am fairly close but I am having trouble figuring out how to get a matching number of records from another layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 20:03:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741019#M57291</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-10-03T20:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741020#M57292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not 100% clear on what you're trying to accomplish. It might help if you post the latest version of your script. Can you help me understand your desired steps?&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I think I understand this step. You want to select points that fall within your Dist_LL feature class.&lt;/LI&gt;&lt;LI&gt;You lose me a bit here. Are all the selected points going to have the same values for a set of fields?&lt;/LI&gt;&lt;LI&gt;What other layer are you trying to populate? Do the fields match between the layer where you've selected some points and the layer you want to update with the values of the selected points?&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 20:59:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741020#M57292</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2019-10-03T20:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741021#M57293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Micah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The points do fall inside the Dist_LL layer, and the Dist_LL layer has&lt;/P&gt;&lt;P&gt;populated values in the fields. The points that fall inside have the same&lt;/P&gt;&lt;P&gt;fields(though named differently) but are null. The points are a set of&lt;/P&gt;&lt;P&gt;different feature classes, and I'm trying to see if I can get the feature&lt;/P&gt;&lt;P&gt;classes that have null values in them get populated using values in the&lt;/P&gt;&lt;P&gt;fields in the Dist_LL layer. I don't have access to my updated script but I&lt;/P&gt;&lt;P&gt;will post it once I get back to the office tomorrow. I hoped this&lt;/P&gt;&lt;P&gt;explanation is a bit clearer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2019 21:17:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741021#M57293</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-10-03T21:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741022#M57294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Micah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the updated portion of the script. I am trying to figure out a solution to just return the selected records in the Dist_LL layer based on the number of selected records in fc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;for fc in fcs:
    geometryType = arcpy.Describe(fc).shapeType
    print geometryType
    if geometryType == 'Point':

        #Get feature class name
        fcsname = os.path.basename(fc)
        name = os.path.splitext(fcsname)
        y = name[1].lstrip('.')
        print y

        #Get these fields from feature classes
        fields = ["OID@", "LANDDISTRICT", "LANDLOT"]

        for row in arcpy.da.SearchCursor(fc, fields):
            if row[1] is None:
                arcpy.MakeFeatureLayer_management(fc, 'fc_layer')
                arcpy.SelectLayerByLocation_management('fc_layer', 'INTERSECT', 'DistLL_layer')
                for DLrow in arcpy.da.SearchCursor('DistLL_layer', ["LAND_DIST", "LAND_LOT"]):
                    print DLrow
                print row
            elif row[2] is None:
                print row
            else:
                continue‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am not sure if the problem lies with the way the search cursor is ran or if it was even set up to return the selected features. I will try to modify this to see if I can get the correct result to return, but I am not sure how to get there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I keep receiving this error message for some reason and I don't know how to offset this error. It occurs every time and I don't know if it is the way it is nested or if it is due to not being deleted. I will try a couple of things to see if I can correct this but this error is new to me. Any assistance on this would also be greatly appreciated.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  File &lt;SPAN class="string token"&gt;"U:\Models_Tools\Scripts related to Landlot and District\Populate Landlot and District.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;31&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'fc_layer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  File &lt;SPAN class="string token"&gt;"C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;6993&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; MakeFeatureLayer
    &lt;SPAN class="keyword token"&gt;raise&lt;/SPAN&gt; e
ExecuteError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Failed to execute&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; Parameters are &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; valid&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
ERROR &lt;SPAN class="number token"&gt;000725&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Output Layer&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Dataset fc_layer already exists&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
Failed to execute &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;MakeFeatureLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you very much for your help Micah.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:32:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741022#M57294</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2021-12-12T07:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741023#M57295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never mind about the error. I came up with this solution and it seems to work.&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;feature_layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;y &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'_layer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 12:05:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741023#M57295</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-10-04T12:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741024#M57296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You had a couple different issues come up in this thread, but please mark the one that helped the most as correct to close the thread out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 14:02:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741024#M57296</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-10-04T14:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741025#M57297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand your workflow much better now. It sounds like you want to transfer attributes from a polygon layer to the point layers that fall within it, where the corresponding attributes (although they are named differently) are null. Using search cursors may be feasible, but I think using a spatial join will be easier, especially if you have lots and lots of points in each layer. Nested cursors are pretty slow to run, sadly. Here's what I'd recommend:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;After line 4 below, use the where clause parameter of the Make Feature Layer tool to create a feature layer only where the relevant attribute ("LANDDISTRICT" is it?) is null&lt;/LI&gt;&lt;LI&gt;Run a&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm"&gt;Spatial Join&lt;/A&gt;&amp;nbsp;with your point feature layer as the target features, your polygon feature layer as the join features, and an output feature class in the in_memory workspace&lt;/LI&gt;&lt;LI&gt;Use the Add Join tool to join your output point features back to your original point feature layer - the OIDs should be a correct match.&lt;/LI&gt;&lt;LI&gt;Use the Calculate Field tool to update the null values&amp;nbsp;with the values from the polygon layer.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 14:22:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741025#M57297</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2019-10-04T14:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with selecting features by location using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741026#M57298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Micah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transferring the field values form the Dist_LL feature class to the other feature classes is what&amp;nbsp;I&amp;nbsp;am trying to accomplish. I wasn't quite sure if a spatial join would work in this instance, because I tried that method using modelbuilder and unfortunately I could not get any ID fields to match. The other method that I tried was to do an intersect on the features and then use the add join method to match the IDs which works, but I think&amp;nbsp;another issue&amp;nbsp;is that some of the features may overlap one another (long story as to why) or there may be another reason. I just also noticed that we have 0 for some values in the fields so I will need to make some slight modifications to the script to update those values as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just another quick question(still corresponding to this thread).&amp;nbsp;What is the difference between using the SearchCursor and specifying a query to get certain values vs. using the SearchCursor and running if/else statements to identify certain values. I am not quite sure&amp;nbsp;which one is used over the other, and which one do would work best in this situation or does it not matter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 16:41:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-selecting-features-by-location-using/m-p/741026#M57298</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2019-10-04T16:41:19Z</dc:date>
    </item>
  </channel>
</rss>

