What is the python expression for the second, third, fourth etc etc vertex along a line feature? !shape.firstpoint¡ is the first vertex and !shape.lastpoint¡ is the last vertex, but what's the expression for other vertices down the line?
I agree with Luke that cursors are best when working with more in-depth properties or methods of geometries. If you must work with the Field Calculator, the "Code samples -- geometry" section of Calculate Field examples—Help | ArcGIS Desktop shows how you would retrieve the geometry and then process it in a code block.
Theres no specific way to do this, this is likely a design decision, as features can have theoretically unlimited vertexes so loading all this info to populate a dictionary etc, could be expensive and have potential to massively slow down cursors.
Check out this article, that tells you the exact same thing I could but using many more words and much more coherently:
Reading geometries—ArcPy Get Started | ArcGIS Desktop
The code at the bottom should allow you to do as you require.
<SPAN class="keyword token">import</SPAN> arcpy infc <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetParameterAsText<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Enter for loop for each feature</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>infc<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"OID@"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"SHAPE@"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># Print the current multipoint's ID</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Feature {}:"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> partnum <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN> <SPAN class="comment token"># Step through each part of the feature</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">for</SPAN> part <SPAN class="keyword token">in</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># Print the part number</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Part {}:"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>partnum<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Step through each vertex in the feature</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">for</SPAN> pnt <SPAN class="keyword token">in</SPAN> part<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> pnt<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># Print x,y coordinates of current point</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"{}, {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>pnt<SPAN class="punctuation token">.</SPAN>X<SPAN class="punctuation token">,</SPAN> pnt<SPAN class="punctuation token">.</SPAN>Y<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># If pnt is None, this represents an interior ring</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Interior Ring:"</SPAN><SPAN class="punctuation token">)</SPAN> partnum <SPAN class="operator token">+=</SPAN> 1p <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.