<?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: Move inidividual polyline vertex in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120155#M9435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neal, if someone's response addresses your question and you don't need any further assistance, please mark it as correct so the status gets updated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Mar 2018 17:05:44 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2018-03-19T17:05:44Z</dc:date>
    <item>
      <title>Move inidividual polyline vertex in Python</title>
      <link>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120152#M9432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a feature class with polylines that represent pipes.&amp;nbsp; Each polyline feature is single-part and generally only has small number of vertices (generally 2 - 5).&amp;nbsp; In some cases I need to update the starting and/or ending node/vertex&amp;nbsp; to a new location, without moving the other vertices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do this in Python either through field calculator or a separate script/tool.&amp;nbsp; I was planning on getting the geometry of the feature, creating an array with vertex points, updating first and/or last point, in the array, and then updating the feature geometry.&amp;nbsp; However, I am having a difficult time figuring out the syntax.&amp;nbsp; If I use a arcpy.da cursor, I can get the feature geometry (I think), but cant seem to pull the geometry properties.&amp;nbsp; Below is quick syntax I used in Python window in ArcMap.&amp;nbsp; Once I get to the row (feature), I thought I would be able to access polyline geometry properties to get the verticies, but keep getting message that data is tuple and is not callable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advise would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Neal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; with arcpy.da.SearchCursor(fc,'SHAPE@') as cursor:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(row)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;(&amp;lt;Polyline object at 0x45afe4b0[0x276eb760]&amp;gt;,)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 14:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120152#M9432</guid>
      <dc:creator>NealBanerjee</dc:creator>
      <dc:date>2018-03-19T14:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Move inidividual polyline vertex in Python</title>
      <link>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120153#M9433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you are going to be updating data, I recommend &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/updatecursor-class.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/updatecursor-class.htm"&gt;UpdateCursor—Help | ArcGIS Desktop&lt;/A&gt; .&amp;nbsp; Whether using an ArcPy DA Update or Search cursor, the "row" is returned as a list or tuple.&amp;nbsp; If you only have a single field, it is still returned as a single item in a list or tuple, so use syntax like:&amp;nbsp; &lt;SPAN style="font-family: courier\ new, courier, monospace;"&gt;shape = row[0]&lt;/SPAN&gt;.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 15:08:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120153#M9433</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-03-19T15:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Move inidividual polyline vertex in Python</title>
      <link>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120154#M9434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you - that was the trick.&amp;nbsp; I was hung up on syntax of working with tuple.!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 15:28:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120154#M9434</guid>
      <dc:creator>NealBanerjee</dc:creator>
      <dc:date>2018-03-19T15:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Move inidividual polyline vertex in Python</title>
      <link>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120155#M9435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neal, if someone's response addresses your question and you don't need any further assistance, please mark it as correct so the status gets updated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 17:05:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120155#M9435</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-03-19T17:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Move inidividual polyline vertex in Python</title>
      <link>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120156#M9436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it to work on a simple test.&amp;nbsp; Below is Python code that worked to move just the first vertex of a polyline based on updated coordinates.&amp;nbsp; NewX1 and NewY1 fields are updated X,Y.&amp;nbsp; Attached is simple graphic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;fc=r"C:\Users\nbanerjee\Documents\ArcGIS\Default.gdb\kmeline"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(fc,['SHAPE@','NewX1','NewY1']) as cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geofeat=row[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geoarry=geofeat.getPart(0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oldX1=geoarry[0].X&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oldY1=geoarry[0].Y&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print('{0},{1}'.format(oldX1,oldY1))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geoarry[0].X=row[1]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geoarry[0].Y=row[2]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newply=arcpy.Polyline(geoarry)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0]=newply&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Original line (red) and new line after 1st vertex move (green)" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/399257_vertexmove.png" style="width: 620px; height: 388px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 17:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-inidividual-polyline-vertex-in-python/m-p/120156#M9436</guid>
      <dc:creator>NealBanerjee</dc:creator>
      <dc:date>2018-03-19T17:37:34Z</dc:date>
    </item>
  </channel>
</rss>

