<?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: Using Arcade to Iterate Over Polyline Vertices in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257956#M729</link>
    <description>&lt;P&gt;These related posts might be of interest:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&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;/LI&gt;&lt;LI&gt;&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;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Tue, 14 Feb 2023 14:08:54 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2023-02-14T14:08:54Z</dc:date>
    <item>
      <title>Using Arcade to Iterate Over Polyline Vertices</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257901#M727</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hey Esri Community!&lt;/P&gt;&lt;P&gt;Hope you're all doing well. I'm working on a project and I'm wondering if any of you know if it's possible to iterate over the vertices of a polyline in Arcade and set the height of each vertex to a specific value, say -0.80?&lt;/P&gt;&lt;P&gt;If you have any tips or resources that could help me out with this, I'd really appreciate it!&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;&lt;P&gt;Best, Stefan&lt;/P&gt;&lt;P&gt;PS: I know, it would be more convinient to just set the default value of the z-value to the desired height but somehow this is not an option in this project &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;PPS: This is the code I have come up so far:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;if (...)){&lt;BR /&gt;var lineGeo = Geometry($feature);&lt;BR /&gt;var linePaths = lineGeo.paths;&lt;BR /&gt;var newPath = [];&lt;/P&gt;&lt;P&gt;for (var lineSegment in linePaths){&lt;BR /&gt;for(var vertex in linePaths[lineSegment]){&lt;BR /&gt;var startPoint = linePaths[lineSegment][vertex][0]&lt;BR /&gt;var endPoint = linePaths[lineSegment][vertex][1]&lt;BR /&gt;var height = -0.80&lt;BR /&gt;var newSegment = [startPoint, endPoint, height]&lt;BR /&gt;push(newPath, newSegment)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var newLineGeo = Polyline({&lt;BR /&gt;paths: [newPath],&lt;BR /&gt;hasZ: true,&lt;BR /&gt;spatialReference: lineGeo.spatialReference&lt;BR /&gt;});&lt;BR /&gt;return newLineGeo&lt;BR /&gt;} else {&lt;BR /&gt;return Geometry($feature);&lt;BR /&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Feb 2023 10:42:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257901#M727</guid>
      <dc:creator>StefanAngerer</dc:creator>
      <dc:date>2023-02-14T10:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Iterate Over Polyline Vertices</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257911#M728</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// return early if your condition is false
// this makes the rest of the code more readable
var condition = true
if(!condition) {
    return Geometry($feature)
}

var paths = Geometry($feature).paths
var new_paths = []
for(var p in paths) {
    var path = paths[p]
    var new_path = []
    for(var v in path) {
        var vertex = path[v]
        var new_vertex = [vertex.x, vertex.y, -0.8]
        Push(new_path, new_vertex)
    }
    Push(new_paths, new_path)
}
return Polyline({paths: new_paths, spatialReference: Geometry($feature).spatialReference})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 12:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257911#M728</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-02-14T12:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Iterate Over Polyline Vertices</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257956#M729</link>
      <description>&lt;P&gt;These related posts might be of interest:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&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;/LI&gt;&lt;LI&gt;&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;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 14 Feb 2023 14:08:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/using-arcade-to-iterate-over-polyline-vertices/m-p/1257956#M729</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-02-14T14:08:54Z</dc:date>
    </item>
  </channel>
</rss>

