<?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: Arcade: Get paths array from feature — why so much overhead? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1365446#M76857</link>
    <description>&lt;P&gt;For future reference, when my organization moves from Pro 2.6.8 to Pro 3.2(?):&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;...copy your geoemtry(can do this by calling Dictionary(geo) on it, prior to 3.2, you need to call Dictionary(Text(geo))).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/attribute-rules-questions/arcade-modify-only-z-geometry/m-p/1365442/highlight/true#M1227" target="_self"&gt;Arcade modify only Z geometry&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2024 17:14:38 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2024-01-02T17:14:38Z</dc:date>
    <item>
      <title>Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1150899#M52398</link>
      <description>&lt;P&gt;Esri has a &lt;U&gt;calculation attribute rule&lt;/U&gt;&amp;nbsp;expression on GitHub called&amp;nbsp;&lt;A href="https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/SetMsToIndex.md" target="_self"&gt;Set Ms to Index&lt;/A&gt;. The script loops through polyline vertices and updates the M-Values.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;current_line_geo&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN class=""&gt;Geometry&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;$&lt;STRONG&gt;feature&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;line_geo&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt;  &lt;STRONG&gt;&lt;SPAN class=""&gt;Dictionary&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Text&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;current_line_geo&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;paths&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;line_geo&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;'paths'&lt;/SPAN&gt;&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;FONT color="#999999"&gt;&lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;path_idx&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;paths&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;{&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;vert_idx&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;paths&lt;/SPAN&gt;&lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;path_idx&lt;/SPAN&gt;&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;){&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;That script works, but I'm having trouble understanding all the prep work that's involved -- for converting the feature's geometry into an array:&lt;/P&gt;&lt;P&gt;Feature —&amp;gt; Geometry —&amp;gt; Text —&amp;gt; &lt;A href="https://developers.arcgis.com/arcade/guide/types/#dictionary" target="_self"&gt;Dictionary (type)&amp;nbsp;&lt;/A&gt;—&amp;gt; Paths array&amp;nbsp;&lt;FONT color="#999999"&gt;(array is a&amp;nbsp;key/value pair within dict)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;That seems like a lot of overhead just to get at the vertices. Would someone be able to explain why all of those steps are needed — or if it can be simplified?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 05:35:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1150899#M52398</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-03-07T05:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1150917#M52401</link>
      <description>&lt;P&gt;An Esri person would probably know the specifics, but I would imagine its just the way the objects are structures.&lt;/P&gt;&lt;P&gt;You need Geometry to get the "shape" of the feature.&amp;nbsp; This is probably stored in a blob or geometry data type, so you have to convert it to Text to use it later.&amp;nbsp; That text is probably formatted as JSON or some other format that can hold more than just the X,Y data of the object's shape,&amp;nbsp; so it has to be converted to a Dictionary (see below - generated by labeling simple test features with "line_geo" stolen from your first two lines of of code in your original post)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1646431193763.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35668i076E5B196F01C042/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1646431193763.png" alt="KimGarbade_0-1646431193763.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;we can see the dictionary contains an array called "paths" that stores the feature's coordinates.&amp;nbsp; So to reference that you have to pull it out of there...hence paths.&lt;/P&gt;&lt;P&gt;Sort of makes sense.&amp;nbsp; I image its to keep Arcade on the "Simple" side.&amp;nbsp; To reference Geometry objects directly you would probably have to use something more like ArcObjects and object oriented programming...&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 22:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1150917#M52401</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-03-04T22:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1151045#M52426</link>
      <description>&lt;P&gt;For cases where we don’t need to update paths, I wonder if something simpler could work instead:&lt;/P&gt;&lt;PRE&gt; for (var part in Geometry($feature).paths) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var line_part = Geometry($feature).paths[part]&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;I’m not sure if I understood that correctly though.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Source: &amp;nbsp;&lt;A href="https://github.com/Esri/arcade-expressions/blob/1df916dda1ba99cc6ef43345287d63348486b5de/attribute_rule_calculation/CreatePointsAlongLine.js#L18" target="_self"&gt;ESRI’s GitHub of Arcade expressions -&amp;nbsp;CreatePointsAlongLine&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Related:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/are-arcade-geometry-subtypes-immutable-i-e-point/m-p/1150097#M52278" target="_self"&gt;Are Arcade geometry subtypes immutable? (i.e. point, polyline, polygon)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 20:32:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1151045#M52426</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-03-06T20:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1151070#M52431</link>
      <description>&lt;P&gt;Strongly advise against call Geometry in a loop, declare a variable outside and set that to the geometry.&lt;/P&gt;&lt;P&gt;Edit: I fixed this example so it does not call geo in a loop -&amp;nbsp;&lt;SPAN&gt;Source: &amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/Esri/arcade-expressions/blob/1df916dda1ba99cc6ef43345287d63348486b5de/attribute_rule_calculation/CreatePointsAlongLine.js#L18" target="_self" rel="nofollow noopener noreferrer"&gt;ESRI’s GitHub of Arcade expressions -&amp;nbsp;CreatePointsAlongLine&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;var geo = Geometry($feature);&lt;BR /&gt;for (var part in geo.paths) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var line_part = geo.paths[part]&lt;/PRE&gt;&lt;P&gt;Geometry are immutable, so you cannot change the X,Y,Z,M of one, but a trick is to convert the geometry to text and then to a dict, then you can edit the shape and return it to update the feature.&amp;nbsp; If you are not modify the geometry, then you do not need to do it.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;current_line_geo&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN class=""&gt;Geometry&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;$&lt;STRONG&gt;feature&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;line_geo&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt;  &lt;STRONG&gt;&lt;SPAN class=""&gt;Dictionary&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Text&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;current_line_geo&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;paths&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;line_geo&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;'paths'&lt;/SPAN&gt;&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;FONT color="#999999"&gt;&lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;path_idx&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;paths&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;{&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;vert_idx&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; &lt;SPAN class=""&gt;paths&lt;/SPAN&gt;&lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;path_idx&lt;/SPAN&gt;&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;){&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;To understand paths versus just a list of vertices(or is it vertex's), lines can be multipart, each part is a path, each path is composed of 2 or more vertices.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 14:27:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1151070#M52431</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2022-03-06T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1152048#M52571</link>
      <description>&lt;P&gt;Idea -&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/arcade-docs-working-with-vertices/idi-p/1152038" target="_self"&gt;Arcade docs: Working with vertices&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 08:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1152048#M52571</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-03-09T08:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1183404#M56236</link>
      <description>&lt;P&gt;Here is a great code sample for looping through polyline segments and getting the midpoint.It really helped me understand the structure in arcade&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/how-to-get-the-mid-point-x-y-of-a-polyline-segment/m-p/393153/highlight/true#M19667" target="_self"&gt;https://community.esri.com/t5/arcgis-online-questions/how-to-get-the-mid-point-x-y-of-a-polyline-segment/m-p/393153/highlight/true#M19667&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 04:30:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1183404#M56236</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2022-06-16T04:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1183418#M56238</link>
      <description>&lt;P&gt;This example might be helpful to some people:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/arcade-code-review-set-polyline-m-values-to/m-p/1157702/highlight/true#M53244" target="_self"&gt;Arcade Code Review: Set polyline M-values to cumulative length of line&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 08:48:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1183418#M56238</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-06-27T08:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Get paths array from feature — why so much overhead?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1365446#M76857</link>
      <description>&lt;P&gt;For future reference, when my organization moves from Pro 2.6.8 to Pro 3.2(?):&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;...copy your geoemtry(can do this by calling Dictionary(geo) on it, prior to 3.2, you need to call Dictionary(Text(geo))).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/attribute-rules-questions/arcade-modify-only-z-geometry/m-p/1365442/highlight/true#M1227" target="_self"&gt;Arcade modify only Z geometry&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 17:14:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-get-paths-array-from-feature-why-so-much/m-p/1365446#M76857</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-02T17:14:38Z</dc:date>
    </item>
  </channel>
</rss>

