<?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: How to adjust polyline / polygon vertices in ArcMap 10.0 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92766#M7256</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ for explaining the reason for checking the pnt object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 29 Nov 2014 00:19:09 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2014-11-29T00:19:09Z</dc:date>
    <item>
      <title>How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92760#M7250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi - I am new to using Python and have a database with a lot of polygons and polylines that need to have their vertex coordinates adjusted based on another calculation.&amp;nbsp; I cannot add new fields to the tables, so I want to edit them directly using arcpy code.&lt;/P&gt;&lt;P&gt;I have looked around the web and have not found a clear (to me) procedure (using Arcmap 10.0) to edit and save the new vertex coordinates for each feature.&lt;/P&gt;&lt;P&gt;Our company won't be upgrading Arcmap for at least 6 months or more, so using the da tools in 10.1 is out.&lt;/P&gt;&lt;P&gt;BTW, there are no rings to iterate thru.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I would be happy to buy someone a virtual beer for their assistance.&amp;nbsp; Thanks a bunch!.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2014 16:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92760#M7250</guid>
      <dc:creator>GaryCrowley</dc:creator>
      <dc:date>2014-11-27T16:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92761#M7251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe it´s good to read these topics first:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/#/Reading_geometries/002z0000001t000000/"&gt;reading geomeries&lt;/A&gt; and &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/#/Writing_geometries/002z0000001v000000/"&gt;writing geometries&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2014 17:22:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92761#M7251</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-27T17:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92762#M7252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I read those and have no trouble reading the vertex information.&amp;nbsp; It's the part about creating a new point in the array and reassigning the array to the original feature that is stumping me.&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2014 19:47:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92762#M7252</guid>
      <dc:creator>GaryCrowley</dc:creator>
      <dc:date>2014-11-27T19:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92763#M7253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, to throw in an example using 10.0 syntax (although in run it on 10.2.2) would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

fc = r"C:\Forum\EditVertices\test.gdb\polygons"
oid = 2 # objectid to change geometry

# Identify the required fields
desc = arcpy.Describe(fc)
shapefieldname = desc.ShapeFieldName
oidfieldname= desc.OIDFieldName

# create a where clause
where = "{0} = {1}".format(arcpy.AddFieldDelimiters(fc, oidfieldname), oid)

# Create update cursor
rows = arcpy.UpdateCursor(fc, where_clause=where)

# Enter for loop for each feature/row
for row in rows:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create the geometry object
&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = row.getValue(shapefieldname)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create an array for the updated feature
&amp;nbsp;&amp;nbsp;&amp;nbsp; arr_feat = arcpy.Array()

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Step through each part of the feature
&amp;nbsp;&amp;nbsp;&amp;nbsp; partnum = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in feat:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create an array for the part
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arr_part = arcpy.Array()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Step through each vertex in the feature
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for pnt in feat.getPart(partnum):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if pnt:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = pnt.X
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y = pnt.Y

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something with the point coordinates
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 5
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y += 5

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add the point to the part array
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arr_part.add(arcpy.Point(x, y))

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # If pnt is None, this represents an interior ring
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # add part to feature array
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arr_feat.add(arr_part)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; partnum += 1

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create polygon
&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(arr_feat)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # set polygon to shapefield and update row
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(shapefieldname, polygon)
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happens in the code is that the polygon with OBJECTID is moved (x+5 and y+5). See image below:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="MoveVertices.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/35276_MoveVertices.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;If you want to edit vertices of a polygon individually, make sure that the first and last point coincide to force closure of the polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:33:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92763#M7253</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T23:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92764#M7254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks - that got me running just fine.&amp;nbsp; I owe you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="images?q=tbn:ANd9GcRw97KAjyAP9QeIJFSTwiOspCohOqfbKo-_DU6JvD-GSHLe9qcz" class="jive-image image-1" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRw97KAjyAP9QeIJFSTwiOspCohOqfbKo-_DU6JvD-GSHLe9qcz" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your snippet:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword"&gt;for pnt &lt;SPAN class="keyword"&gt;in&lt;/SPAN&gt; feat.getPart(partnum):&amp;nbsp; &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class="keyword"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if pnt:&amp;nbsp; &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;what is&amp;nbsp; &lt;EM&gt;if pnt:&lt;/EM&gt; checking for?&amp;nbsp; This seems to be a shortened version of if pnt = something.&amp;nbsp; Can you elaborate?&amp;nbsp; Sorry, I'm a Python newbie...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;IMG alt="images?q=tbn:ANd9GcSO240-AH8n61U2Bs7E8DqaOca7OPBbdb7qFUVjVtHh5-kCuR5R" class="jive-image image-2" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSO240-AH8n61U2Bs7E8DqaOca7OPBbdb7qFUVjVtHh5-kCuR5R" style="height: auto;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 23:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92764#M7254</guid>
      <dc:creator>GaryCrowley</dc:creator>
      <dc:date>2014-11-28T23:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92765#M7255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander's if pnt line checks to see if the object in the list is a point object...if it isn't, it skips the "if" section.&amp;nbsp; This can occur when a feature is a multipart feature and/or has inner rings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 23:35:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92765#M7255</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-28T23:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92766#M7256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ for explaining the reason for checking the pnt object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Nov 2014 00:19:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92766#M7256</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-29T00:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust polyline / polygon vertices in ArcMap 10.0</title>
      <link>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92767#M7257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/97143"&gt;Gary Crowley&lt;/A&gt;‌, Thanx for the virtual beer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For now I think it's best to mark the answer as correct so other people may find the solution more easy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Nov 2014 00:21:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-adjust-polyline-polygon-vertices-in-arcmap/m-p/92767#M7257</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-29T00:21:22Z</dc:date>
    </item>
  </channel>
</rss>

