<?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 I need to move a set of point features based on the XY values from another feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50163#M3930</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;#My goal is similar to the thread listed below:&lt;BR /&gt;&lt;SPAN&gt;#&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2145" data-containertype="14" data-objectid="158291" data-objecttype="1" href="https://community.esri.com/thread/158291"&gt;https://community.esri.com/thread/158291&lt;/A&gt;&lt;BR /&gt;#"I need to move a set of point features based on the XY values from another table linked through table join"&lt;/P&gt;&lt;P&gt;#This script works perfectly as long as the feature class with the outdated xy's have no duplicate "PREM_ID" numbers.&lt;BR /&gt;# A "PREM_ID" number represents a Geocoded address point and its possible to have several of them stacked on top of each other on one parcel. &lt;BR /&gt;#Unfortunately my outdated xy feature class has a combination of both unique and duplicate PREM_ID numbers and this script will not pass duplicate PREM_ID numbers. &lt;BR /&gt;#IndexError: list index out of range&lt;BR /&gt;#Thank You for your assistance,&lt;BR /&gt;#Larry Adgate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy &lt;BR /&gt; &lt;BR /&gt;#input path of gdb where original feature class resides &lt;BR /&gt;gdb = "C:\\Projects\\MyProject\\Arden.gdb"&lt;/P&gt;&lt;P&gt;#input original feature class path with outdated XY (This feature Class has both unique and duplicate "PREM_ID" numbers) &lt;BR /&gt;basefc = "C:\\Projects\\MyProject\\Arden.gdb\\Arden\\LateralLinesPoints"&lt;/P&gt;&lt;P&gt;#input feature class path of points with updated XY (This Feature Class contains only unque "PREM_ID numbers&lt;BR /&gt;#and not all there numbers can be found in the outdate xy feature class) &lt;BR /&gt;newfc = "C:\\Projects\\MyProject\\Arden.gdb\\Arden\\CCB_Points"&lt;/P&gt;&lt;P&gt;#input field name which has a unique ID to both original and new point feature class &lt;BR /&gt;field = "PREM_ID"&lt;/P&gt;&lt;P&gt;list_idxy = [] &lt;BR /&gt;with arcpy.da.SearchCursor(newfc, [field, "SHAPE@X", "SHAPE@Y"]) as cur: &lt;BR /&gt; for row in cur: &lt;BR /&gt; list_idxy.append(row) &lt;BR /&gt;i = 0 &lt;BR /&gt;with arcpy.da.Editor(gdb) as edit: &lt;BR /&gt; with arcpy.da.UpdateCursor(basefc, [field, "SHAPE@X", "SHAPE@Y"]) as cur: &lt;BR /&gt; for row in cur: &lt;BR /&gt; print row &lt;BR /&gt; if row[0] == list_idxy&lt;I&gt;[0]: &lt;BR /&gt; row[1] = list_idxy&lt;I&gt;[1] &lt;BR /&gt; row[2] = list_idxy&lt;I&gt;[2] &lt;BR /&gt; i += 1 &lt;BR /&gt; cur.updateRow(row) &lt;BR /&gt;print "points shifted!"&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Apr 2018 20:31:51 GMT</pubDate>
    <dc:creator>LarryAdgate</dc:creator>
    <dc:date>2018-04-02T20:31:51Z</dc:date>
    <item>
      <title>I need to move a set of point features based on the XY values from another feature class</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50163#M3930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;#My goal is similar to the thread listed below:&lt;BR /&gt;&lt;SPAN&gt;#&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2145" data-containertype="14" data-objectid="158291" data-objecttype="1" href="https://community.esri.com/thread/158291"&gt;https://community.esri.com/thread/158291&lt;/A&gt;&lt;BR /&gt;#"I need to move a set of point features based on the XY values from another table linked through table join"&lt;/P&gt;&lt;P&gt;#This script works perfectly as long as the feature class with the outdated xy's have no duplicate "PREM_ID" numbers.&lt;BR /&gt;# A "PREM_ID" number represents a Geocoded address point and its possible to have several of them stacked on top of each other on one parcel. &lt;BR /&gt;#Unfortunately my outdated xy feature class has a combination of both unique and duplicate PREM_ID numbers and this script will not pass duplicate PREM_ID numbers. &lt;BR /&gt;#IndexError: list index out of range&lt;BR /&gt;#Thank You for your assistance,&lt;BR /&gt;#Larry Adgate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy &lt;BR /&gt; &lt;BR /&gt;#input path of gdb where original feature class resides &lt;BR /&gt;gdb = "C:\\Projects\\MyProject\\Arden.gdb"&lt;/P&gt;&lt;P&gt;#input original feature class path with outdated XY (This feature Class has both unique and duplicate "PREM_ID" numbers) &lt;BR /&gt;basefc = "C:\\Projects\\MyProject\\Arden.gdb\\Arden\\LateralLinesPoints"&lt;/P&gt;&lt;P&gt;#input feature class path of points with updated XY (This Feature Class contains only unque "PREM_ID numbers&lt;BR /&gt;#and not all there numbers can be found in the outdate xy feature class) &lt;BR /&gt;newfc = "C:\\Projects\\MyProject\\Arden.gdb\\Arden\\CCB_Points"&lt;/P&gt;&lt;P&gt;#input field name which has a unique ID to both original and new point feature class &lt;BR /&gt;field = "PREM_ID"&lt;/P&gt;&lt;P&gt;list_idxy = [] &lt;BR /&gt;with arcpy.da.SearchCursor(newfc, [field, "SHAPE@X", "SHAPE@Y"]) as cur: &lt;BR /&gt; for row in cur: &lt;BR /&gt; list_idxy.append(row) &lt;BR /&gt;i = 0 &lt;BR /&gt;with arcpy.da.Editor(gdb) as edit: &lt;BR /&gt; with arcpy.da.UpdateCursor(basefc, [field, "SHAPE@X", "SHAPE@Y"]) as cur: &lt;BR /&gt; for row in cur: &lt;BR /&gt; print row &lt;BR /&gt; if row[0] == list_idxy&lt;I&gt;[0]: &lt;BR /&gt; row[1] = list_idxy&lt;I&gt;[1] &lt;BR /&gt; row[2] = list_idxy&lt;I&gt;[2] &lt;BR /&gt; i += 1 &lt;BR /&gt; cur.updateRow(row) &lt;BR /&gt;print "points shifted!"&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 20:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50163#M3930</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2018-04-02T20:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: I need to move a set of point features based on the XY values from another feature class</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50164#M3931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you want to do if a duplicate PREM_ID is found?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 20:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50164#M3931</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2018-04-02T20:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: I need to move a set of point features based on the XY values from another feature class</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50165#M3932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James thank you for your assistance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a duplicate PREM_ID is found which is also a duplicate&amp;nbsp;address, it should also go to the same&amp;nbsp;XY as the other duplicate/s. The points will probably stack up in same spot or&amp;nbsp;same xy position.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 21:50:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50165#M3932</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2018-04-02T21:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: I need to move a set of point features based on the XY values from another feature class</title>
      <link>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50166#M3933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might try something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# empty dictionary&lt;/SPAN&gt;
dict &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;

&lt;SPAN class="comment token"&gt;# read PREM_ID as key and coordinates &lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;with&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;newfc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'PREM_ID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@X'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@Y'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cur&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cur&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dict&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'x'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&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="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'y'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&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="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# update old feature&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;basefc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'PREM_ID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@X'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@Y'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; upCur&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; upCur&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# if PREM_ID is in dictionary, update x,y else skip update&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; dict&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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="operator token"&gt;=&lt;/SPAN&gt; dict&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'x'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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="operator token"&gt;=&lt;/SPAN&gt; dict&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'y'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upCur&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Updated {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:56:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/i-need-to-move-a-set-of-point-features-based-on/m-p/50166#M3933</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-10T21:56:09Z</dc:date>
    </item>
  </channel>
</rss>

