<?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: Moving the last vertices in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589455#M46199</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Xander and Ian,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for the quick response! I understand the concept and why the code was wrong. You solved my problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jun 2014 14:21:23 GMT</pubDate>
    <dc:creator>DavidNarkewicz</dc:creator>
    <dc:date>2014-06-06T14:21:23Z</dc:date>
    <item>
      <title>Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589444#M46188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a feature class made up of lines. Each of these lines are loops. Therefore they have the same beginning and ending xy coordinates. I am looking to move the end vertices for each line a known value away to disconnect each loop. I understand that through editor I can manually change the end vertices for each loop in sketch properties but I am looking for an automated way to move the last/end vertices of each line in my feature class the same known distance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example: I move each line's end vertex 5 meters in the x direction and 5 meters in the y direction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any guidance would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 18:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589444#M46188</guid>
      <dc:creator>DavidNarkewicz</dc:creator>
      <dc:date>2014-02-03T18:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589445#M46189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you move the end point of the line it most likely will still be a closed polyline.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will need to manually split them to break them up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could also try the explode function and see if that will get you anywhere.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an off approach fix.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;use calculate geometry to calculate the X,Y of the end points of each line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then take those x,y locations and create point features from them.&amp;nbsp; BUFFER those point features into a polygon layer with a 1 inch buffer.&amp;nbsp; Select all those buffer polygons and clip the polyline layer.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now of you have some that are NOT closed you can calculate beginning and ending x,y and and then only create the points on those features that have identical fromx, fromy and tox toy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sound arduous but the whole thing should take a couple of minutes.&amp;nbsp; '&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would recommend experimenting on a copy first. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I have a feature class made up of lines. Each of these lines are loops. Therefore they have the same beginning and ending xy coordinates. I am looking to move the end vertices for each line a known value away to disconnect each loop. I understand that through editor I can manually change the end vertices for each loop in sketch properties but I am looking for an automated way to move the last/end vertices of each line in my feature class the same known distance.&lt;BR /&gt;&lt;BR /&gt;Example: I move each line's end vertice 5 meters in the x direction and 5 meters in the y direction.&lt;BR /&gt;&lt;BR /&gt;Any guidance would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 18:15:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589445#M46189</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2014-02-03T18:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589446#M46190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you move the end point of the line it most likely will still be a closed polyline.&lt;BR /&gt;&lt;BR /&gt;You will need to manually split them to break them up.&lt;BR /&gt;&lt;BR /&gt;You could also try the explode function and see if that will get you anywhere.&lt;BR /&gt;&lt;BR /&gt;Here is an off approach fix.&lt;BR /&gt;&lt;BR /&gt;use calculate geometry to calculate the X,Y of the end points of each line.&lt;BR /&gt;&lt;BR /&gt;Then take those x,y locations and create point features from them.&amp;nbsp; BUFFER those point features into a polygon layer with a 1 inch buffer.&amp;nbsp; Select all those buffer polygons and clip the polyline layer.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Now of you have some that are NOT closed you can calculate beginning and ending x,y and and then only create the points on those features that have identical fromx, fromy and tox toy&lt;BR /&gt;&lt;BR /&gt;Sound arduous but the whole thing should take a couple of minutes.&amp;nbsp; '&lt;BR /&gt;&lt;BR /&gt;I would recommend experimenting on a copy first.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the reply. I think I need to be clearer in my original post. Each individual line feature creates a loop. There are numerous independent loops. I am looking for a way to basically take OBJECTID of "1" and move its end vertex 5 meters in the x direction and 5 meters in the y direction (this will change the line from a loop to a single line). Then go to OBJECTID of "2" and move its end vertex 5 meters in the x direction and 5 meters in the y direction. Then go to OBJECTID of "3", then "4", then "5" ... and so one until the end of the data-set. At the end each loop will now be a non-loop with each features end point moved the same distance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this is a little clearer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 18:26:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589446#M46190</guid>
      <dc:creator>DavidNarkewicz</dc:creator>
      <dc:date>2014-02-03T18:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589447#M46191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi mapping_narkewicz,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Recently I replied to a somewhat similar question regarding inserting vertices into polylines. See if it gives you some idea about accessing geometries of individual features, how to disassembly them and create new polylines from them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/102063-add-a-vertex-to-multiple-polylines"&gt;http://forums.arcgis.com/threads/102063-add-a-vertex-to-multiple-polylines&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or alternatively, the following tools might help you to do what you need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000003p000000"&gt;arcpy.FeatureVerticesToPoints_management&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Points_To_Line/00170000003s000000/"&gt;arcpy.PointsToLine_management&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;You would also need to do some calculations to shift the relevant points, like for example in &lt;/SPAN&gt;&lt;A href="http://gis.stackexchange.com/questions/65959/how-to-move-offset-point-locations-using-modelbuilder-or-arcpy"&gt;a forum here&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In any case, you may run into problems if the last before last vertex is very close to (or is identical to) the end vertex. You might want to check for that somehow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Filip.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 22:24:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589447#M46191</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2014-02-04T22:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589448#M46192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try the code below on a copy of your data and see if this is what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy fc = r'c:\yourFGDB.gdb\yourLines' x_shift = 5 y_shift = 5&amp;nbsp; # update cursor (be careful with this and try it on a copy of your data) fields = ["SHAPE@"] with arcpy.da.UpdateCursor(fc,fields) as curs: &amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt = part[len(part) - 1] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.X += x_shift &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.Y += y_shift &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part[len(part) - 1] = lastpnt &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array)])&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 06:07:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589448#M46192</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-02-05T06:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589449#M46193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi David,&lt;BR /&gt;&lt;BR /&gt;Try the code below on a copy of your data and see if this is what you want.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r'c:\yourFGDB.gdb\yourLines'
x_shift = 5
y_shift = 5

# update cursor (be careful with this and try it on a copy of your data)
fields = ["SHAPE@"]
with arcpy.da.UpdateCursor(fc,fields) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt = part[len(part) - 1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.X += x_shift
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.Y += y_shift
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part[len(part) - 1] = lastpnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array)])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Xander&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Xander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is great! It works perfect. Now I am wondering if I am able to tweak this code a little with your help. Instead of the shift I now have an attribute field in the polyline dataset that has the centroid for each polyline. I have put these as an "XCentroid" and "YCentroid" field which houses their own numbers as a "double". Instead of the shift I would like to replace the last point with the centroid. I tweaked your code to this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r'c:\yourFGDB.gdb\yourLines'

# update cursor (be careful with this and try it on a copy of your data)
fields = ["SHAPE@","XCentroid","YCentroid"]
with arcpy.da.UpdateCursor(fc,fields) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_shift = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_shift = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt = part[len(part) - 1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.X = x_shift
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.Y = y_shift
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part[len(part) - 1] = lastpnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array)])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the error: TypeError: sequence size must match size of the row&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:19:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589449#M46193</guid>
      <dc:creator>DavidNarkewicz</dc:creator>
      <dc:date>2021-12-12T01:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589450#M46194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You're nearly there...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess the problem is that the row you write should have the same dimensions as the row you read. I renamed the x_shift and y_shift variables to x_new and y_new for readability. I didn't test this, but if I think this could work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r'c:\yourFGDB.gdb\yourLines'

# update cursor (be careful with this and try it on a copy of your data)
fields = ["SHAPE@","XCentroid","YCentroid"]
with arcpy.da.UpdateCursor(fc,fields) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_new = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_new = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt = part[len(part) - 1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.X = x_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.Y = y_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part[len(part) - 1] = lastpnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array), x_new, y_new])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:19:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589450#M46194</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T01:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589451#M46195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I completely understand the error now. This works solution works perfect! Thank you so much Xander.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 13:54:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589451#M46195</guid>
      <dc:creator>DavidNarkewicz</dc:creator>
      <dc:date>2014-02-05T13:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589452#M46196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi David,&lt;BR /&gt;&lt;BR /&gt;You're nearly there...&lt;BR /&gt;&lt;BR /&gt;I guess the problem is that the row you write should have the same dimensions as the row you read. I renamed the x_shift and y_shift variables to x_new and y_new for readability. I didn't test this, but if I think this could work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r'c:\yourFGDB.gdb\yourLines'

# update cursor (be careful with this and try it on a copy of your data)
fields = ["SHAPE@","XCentroid","YCentroid"]
with arcpy.da.UpdateCursor(fc,fields) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_new = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_new = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt = part[len(part) - 1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.X = x_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastpnt.Y = y_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part[len(part) - 1] = lastpnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array), x_new, y_new])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Xander&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Xander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am now trying to move the first vertex just like I needed for the last vertex.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have altered the code to the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r'c:\yourFGDB.gdb\yourLines'

# update cursor (be careful with this and try it on a copy of your data)
fields = ["SHAPE@","XCentroid","YCentroid"]
with arcpy.da.UpdateCursor(fc,fields) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_new = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_new = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstpnt = part[len(part) + 0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstpnt.X = x_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstpnt.Y = y_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; part[len(part) - 1] = firstpnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array), x_new, y_new])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do you queue the first vertex? My assumption of "firstpnt = part[len(part) + 0]" is wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:19:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589452#M46196</guid>
      <dc:creator>DavidNarkewicz</dc:creator>
      <dc:date>2021-12-12T01:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589453#M46197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;firstpnt = part[len(part) + 0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;needs to be firstpnt = part[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;that will get the first value.&amp;nbsp; prior he was doing len(part) - 1 to get the last one since python lists are 0 indexed, so it took the total number of entries( imagine 755 points the first with index 0, so the last would be index 754 and 755 - 1 = 754.)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 14:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589453#M46197</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-06-06T14:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589454#M46198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Indeed the assumption "firstpnt = part[len(part) + 0]" is wrong. The "part" represents a list of points. Between the square brackets you put the index to the point you're interested in. The list index starts with 0 (for the first point) and ends with the number of points minus 1. Therefor, in case of the last point we used "len(part) - 1", which is the number of points - 1. For the first point you just use index 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r'c:\yourFGDB.gdb\yourLines'

# update cursor (be careful with this and try it on a copy of your data)
fields = ["SHAPE@","XCentroid","YCentroid"]
with arcpy.da.UpdateCursor(fc,fields) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_new = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_new = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in geom:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstpnt = &lt;STRONG&gt;part[0]&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstpnt.X = x_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstpnt.Y = y_new
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;part[0]&lt;/STRONG&gt; = firstpnt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow([arcpy.Polyline(array), x_new, y_new])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this explanation helps you to achieve your goal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:19:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589454#M46198</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T01:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Moving the last vertices</title>
      <link>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589455#M46199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Xander and Ian,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for the quick response! I understand the concept and why the code was wrong. You solved my problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 14:21:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/moving-the-last-vertices/m-p/589455#M46199</guid>
      <dc:creator>DavidNarkewicz</dc:creator>
      <dc:date>2014-06-06T14:21:23Z</dc:date>
    </item>
  </channel>
</rss>

