<?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 Is it possible to move a vertex in a polyline with arcpy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384387#M30286</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a featureclass of polylines with 2 vertices each, I want to be able to keep the line itself, startpoint and the angle, but move endpoint to a specific length.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am doing this in a versioned geodatabase, and currently I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;can &lt;/SPAN&gt;&lt;SPAN&gt;put a new line into the geometry, but the problem is, there are featurelinked annotations which are reset, when the whole line is changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wonder whether it is possible, since I already am in edit mode, to just move lastpoint of the existing line?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps this is not possible with arcpy?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marianne Wiese&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, time, traceback
arcpy.env.workspace = 'Database Connections/mbw.sde'
inFeatures = 'G100.geopoint_mbw_20130930/G100.geopoint_line_2'
newLength = 550
n = 0
try: 
 uCursor = arcpy.da.UpdateCursor(inFeatures, [ 'OID@', 'SHAPE@'])
 edit = arcpy.da.Editor(arcpy.env.workspace)
 edit.startEditing()
 edit.startOperation()
 for row in uCursor:
&amp;nbsp; line = row[1]
&amp;nbsp; factor = newLength/line.length
&amp;nbsp; X2 = line.firstPoint.X + factor * (line.lastPoint.X - line.firstPoint.X)
&amp;nbsp; Y2 = line.firstPoint.Y + factor * (line.lastPoint.Y - line.firstPoint.Y)
&amp;nbsp; array = arcpy.Array([line.firstPoint, arcpy.Point(X2,Y2)])
&amp;nbsp; newLine = arcpy.Polyline(array)
&amp;nbsp; row[1] = newLine
&amp;nbsp; uCursor.updateRow(row)
&amp;nbsp; n += 1
&amp;nbsp; if (n % 1000 == 0):
&amp;nbsp;&amp;nbsp; print time.strftime('%H:%M:%S'), ':&amp;nbsp;&amp;nbsp; ', n
except:
 tb = traceback.format_exc()
 print tb
finally:
 del uCursor
 edit.stopOperation()
 edit.stopEditing(True)
 del edit
print 'all done'
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Oct 2013 15:21:13 GMT</pubDate>
    <dc:creator>Marianne_BilstedWiese</dc:creator>
    <dc:date>2013-10-02T15:21:13Z</dc:date>
    <item>
      <title>Is it possible to move a vertex in a polyline with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384387#M30286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a featureclass of polylines with 2 vertices each, I want to be able to keep the line itself, startpoint and the angle, but move endpoint to a specific length.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am doing this in a versioned geodatabase, and currently I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;can &lt;/SPAN&gt;&lt;SPAN&gt;put a new line into the geometry, but the problem is, there are featurelinked annotations which are reset, when the whole line is changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wonder whether it is possible, since I already am in edit mode, to just move lastpoint of the existing line?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps this is not possible with arcpy?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marianne Wiese&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, time, traceback
arcpy.env.workspace = 'Database Connections/mbw.sde'
inFeatures = 'G100.geopoint_mbw_20130930/G100.geopoint_line_2'
newLength = 550
n = 0
try: 
 uCursor = arcpy.da.UpdateCursor(inFeatures, [ 'OID@', 'SHAPE@'])
 edit = arcpy.da.Editor(arcpy.env.workspace)
 edit.startEditing()
 edit.startOperation()
 for row in uCursor:
&amp;nbsp; line = row[1]
&amp;nbsp; factor = newLength/line.length
&amp;nbsp; X2 = line.firstPoint.X + factor * (line.lastPoint.X - line.firstPoint.X)
&amp;nbsp; Y2 = line.firstPoint.Y + factor * (line.lastPoint.Y - line.firstPoint.Y)
&amp;nbsp; array = arcpy.Array([line.firstPoint, arcpy.Point(X2,Y2)])
&amp;nbsp; newLine = arcpy.Polyline(array)
&amp;nbsp; row[1] = newLine
&amp;nbsp; uCursor.updateRow(row)
&amp;nbsp; n += 1
&amp;nbsp; if (n % 1000 == 0):
&amp;nbsp;&amp;nbsp; print time.strftime('%H:%M:%S'), ':&amp;nbsp;&amp;nbsp; ', n
except:
 tb = traceback.format_exc()
 print tb
finally:
 del uCursor
 edit.stopOperation()
 edit.stopEditing(True)
 del edit
print 'all done'
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 15:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384387#M30286</guid>
      <dc:creator>Marianne_BilstedWiese</dc:creator>
      <dc:date>2013-10-02T15:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to move a vertex in a polyline with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384388#M30287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is changing the last point X coordinate value according the coordinate system distance unit working ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 21:46:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384388#M30287</guid>
      <dc:creator>SchoppMatthieu</dc:creator>
      <dc:date>2013-10-02T21:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to move a vertex in a polyline with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384389#M30288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for answering, Matshopp.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, as you&amp;nbsp; can see in my code, I already read the vertex positions from the geometry. Problem is, that Arcpy's access to polyline object properties is readonly, so that I must make a new line and put that into geometry object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess it has to do with the granularity of arcpy's methods.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had hoped for another library to exist, which could programmatically go into edit mode more in details.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marianne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 09:02:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-possible-to-move-a-vertex-in-a-polyline-with/m-p/384389#M30288</guid>
      <dc:creator>Marianne_BilstedWiese</dc:creator>
      <dc:date>2013-10-03T09:02:10Z</dc:date>
    </item>
  </channel>
</rss>

