<?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: Selecting points within polygon and updating attributes using ArcPy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354774#M27911</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua,&lt;/P&gt;&lt;P&gt;I did it like this, but still updates only sing one value from polygon:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with arcpy.da.SearchCursor("Poly","name") as cursor:&lt;BR /&gt;... for row_lsd in cursor:&lt;BR /&gt;... arcpy.SelectLayerByLocation_management("Points","INTERSECT","Poly","","NEW_SELECTION")&lt;BR /&gt;... with arcpy.da.UpdateCursor("Points",["name"])as cursor_a:&lt;BR /&gt;... for row_a in cursor_a:&lt;BR /&gt;... row_a[0]=row_lsd[0]&lt;BR /&gt;... cursor_a.updateRow(row_lsd)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Nov 2019 09:02:38 GMT</pubDate>
    <dc:creator>Vakhtang_Zubiashvili</dc:creator>
    <dc:date>2019-11-26T09:02:38Z</dc:date>
    <item>
      <title>Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354770#M27907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two layers, polygon (in code "Poly" and "Points") and point, i want to upload polygon layer attribute to point using intersect (like spatial join). E.g in polygon i have A and B features, i wont to update&amp;nbsp; their values in point layer features attributes which&amp;nbsp;under polygons. When i run my code it runs, but uploads only one value from polygon layer, when i have two values fro different features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a code help me please:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; arcpy&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;&amp;gt;&amp;gt;&amp;gt; cur_pol = arcpy.da.SearchCursor("Poly","name")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; row_pol &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; cur_pol:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management("Points","INTERSECT","Poly","","NEW_SELECTION")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; row &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; arcpy.da.SearchCursor("Points","my_field"):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor("Points")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; row &lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: #004da8;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt; cursor:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.SeniSvna = row_pol[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: -5.0pt; margin: 0in 0in .0001pt 5.0pt;"&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2019 11:15:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354770#M27907</guid>
      <dc:creator>Vakhtang_Zubiashvili</dc:creator>
      <dc:date>2019-11-22T11:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354771#M27908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Several things to comment on regarding the code itself.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You are mixing original ArcPy cursors (arcpy.UpdateCursor) and ArcPy Data Access cursors (arcpy.da.SearchCursor).&amp;nbsp; Although technically it may work if coded properly, mixing the two different styles of cursors is bound to create confusion at some point in terms of maintaining code.&amp;nbsp; I suggest you use all ArcPy DA cursors.&lt;/LI&gt;&lt;LI&gt;Creating a cursor within an existing cursor loop leads to terrible performance.&amp;nbsp; If your outer cursor/loop only has a few records, it might be OK, but the script will take forever if the outer cursor/loop has more than a trivial number of records.&lt;/LI&gt;&lt;LI&gt;In the second half of the code with the nested cursors, you are using the same variable ("row") to loop through each cursor.&amp;nbsp; At a minimum, that will lead to confusion into maintaining the code.&lt;/LI&gt;&lt;LI&gt;In the second half of the code with nested cursors, I am not even sure what your search cursor is accomplishing.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2019 15:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354771#M27908</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-11-22T15:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354772#M27909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whats fields in the polygon layer and in the points layer are you using? Also what is the field mapping? For example What fields in the polygon layer update which fields in the points layer? If this doesn't make sense please let me know and I can explain it another way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:00:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354772#M27909</guid>
      <dc:creator>deleted-user-NvcfpBOWaKwr</dc:creator>
      <dc:date>2019-11-22T16:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354773#M27910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field (from which i want to move value into points layer)&amp;nbsp; in polygon Layer('Poly'&amp;nbsp; --- string)&amp;nbsp; i have is called "NAMES" and in points Layer ('Points' --- ) is "NewName".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try also this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Import arcpy&lt;/P&gt;&lt;P&gt;with arcpy.da.SearchCursor("Poly","NAMES") as cursor:&lt;BR /&gt;... for row_lsd in cursor:&lt;BR /&gt;... arcpy.SelectLayerByLocation_management("Points","INTERSECT","Poly","","NEW_SELECTION")&lt;BR /&gt;... with arcpy.da.UpdateCursor("Points",["NewName"]) as cursor_a:&lt;BR /&gt;... for row_a in cursor_a:&lt;BR /&gt;... row_a[0]=row_lsd[0]&lt;BR /&gt;... cursor_a.updateRow(row_lsd)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It makes update, but updates only one value from Polygon ('Poly'), E.G. i have two names - John and Mike, it update only Mike, even if points features is under John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 08:57:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354773#M27910</guid>
      <dc:creator>Vakhtang_Zubiashvili</dc:creator>
      <dc:date>2019-11-26T08:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354774#M27911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua,&lt;/P&gt;&lt;P&gt;I did it like this, but still updates only sing one value from polygon:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with arcpy.da.SearchCursor("Poly","name") as cursor:&lt;BR /&gt;... for row_lsd in cursor:&lt;BR /&gt;... arcpy.SelectLayerByLocation_management("Points","INTERSECT","Poly","","NEW_SELECTION")&lt;BR /&gt;... with arcpy.da.UpdateCursor("Points",["name"])as cursor_a:&lt;BR /&gt;... for row_a in cursor_a:&lt;BR /&gt;... row_a[0]=row_lsd[0]&lt;BR /&gt;... cursor_a.updateRow(row_lsd)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 09:02:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354774#M27911</guid>
      <dc:creator>Vakhtang_Zubiashvili</dc:creator>
      <dc:date>2019-11-26T09:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354775#M27912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Guys, i did it, thank you for your help &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 09:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354775#M27912</guid>
      <dc:creator>Vakhtang_Zubiashvili</dc:creator>
      <dc:date>2019-11-26T09:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354776#M27913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have found responses helpful, you should mark them Helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 16:34:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354776#M27913</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-11-26T16:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354777#M27914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IFRAME class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Ff0sucd-D2mg%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Df0sucd-D2mg&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Ff0sucd-D2mg%2Fhqdefault.jpg&amp;amp;key=3b4b3cb34e044cb590554f889078322d&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="854" height="480" scrolling="no" title="YouTube embed" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="true"&gt;&lt;/IFRAME&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2020 09:38:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/354777#M27914</guid>
      <dc:creator>SibghatUllah1</dc:creator>
      <dc:date>2020-07-11T09:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/1172755#M64529</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/107000" target="_self"&gt;&lt;SPAN class=""&gt;Vakhtang_Zubiashvili&lt;/SPAN&gt;&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Kindly share the updated code where it is updating the John and Mike both in the "Points" layer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 May 2022 12:35:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/1172755#M64529</guid>
      <dc:creator>GISAdmin29</dc:creator>
      <dc:date>2022-05-11T12:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting points within polygon and updating attributes using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/1174494#M64567</link>
      <description>&lt;P&gt;Thank you so much...!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 12:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-points-within-polygon-and-updating/m-p/1174494#M64567</guid>
      <dc:creator>GISAdmin29</dc:creator>
      <dc:date>2022-05-17T12:27:36Z</dc:date>
    </item>
  </channel>
</rss>

