<?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 Attribute Rule To Insert Lines after Points in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1248989#M6464</link>
    <description>&lt;P&gt;I have no clue about utility services. Is this the structure you're trying to achieve?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1674033493975.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60626i485EF5B66648FBC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1674033493975.png" alt="JohannesLindner_0-1674033493975.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Are the laterals in the same feature class as the water lines?&lt;/P&gt;&lt;P&gt;Do you have relationships between water lines / valves / laterals / plugs based on attributes? Or do you just care about geometry?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 09:21:41 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-01-18T09:21:41Z</dc:date>
    <item>
      <title>Using Arcade Attribute Rule To Insert Lines after Points</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1248793#M6463</link>
      <description>&lt;P&gt;Hello Esri Community,&amp;nbsp; It seems like Arcade is a good option to use in this scenario below:&lt;/P&gt;&lt;P&gt;1. Currently, I have water lines that end at a valve point&lt;/P&gt;&lt;P&gt;2. I'm looking for a way in Arcade to insert a 2ft Service Lateral from those valve points on the downstream side. (opposite side of existing water line that terminate at valve / the clear side)&lt;/P&gt;&lt;P&gt;3. Once Arcade inserts the newly generated 2ft laterals after the valve points, then add a plug to the end point of the new lateral lines.&lt;/P&gt;&lt;P&gt;Is anyone familiar with how to accomplish the above using an Arcade Attribute Rule in ArcGIS Pro 2.9.5?&lt;/P&gt;&lt;P&gt;Thank you for any feedback!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 17:24:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1248793#M6463</guid>
      <dc:creator>Cash_E</dc:creator>
      <dc:date>2023-01-17T17:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade Attribute Rule To Insert Lines after Points</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1248989#M6464</link>
      <description>&lt;P&gt;I have no clue about utility services. Is this the structure you're trying to achieve?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1674033493975.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60626i485EF5B66648FBC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1674033493975.png" alt="JohannesLindner_0-1674033493975.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Are the laterals in the same feature class as the water lines?&lt;/P&gt;&lt;P&gt;Do you have relationships between water lines / valves / laterals / plugs based on attributes? Or do you just care about geometry?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 09:21:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1248989#M6464</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-18T09:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade Attribute Rule To Insert Lines after Points</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1249203#M6465</link>
      <description>&lt;P&gt;This looks correct.&amp;nbsp; The 'Service' lines (laterals) are in the same feature class as the 'Water Main' lines, and each are a subtype from the feature class called 'WaterLine' in a fgdb.&lt;/P&gt;&lt;P&gt;Both subtypes have coded value domains but I can calculate the correct domains once I add the newly generated line segments to that will get a plug.&lt;/P&gt;&lt;P&gt;I just care about the geometry but the features will all eventually participate in a topology.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 19:20:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1249203#M6465</guid>
      <dc:creator>Cash_E</dc:creator>
      <dc:date>2023-01-18T19:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade Attribute Rule To Insert Lines after Points</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1249400#M6467</link>
      <description>&lt;P&gt;OK. You could do something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on the WaterLine feature class
// field: leave empty
// triggers: Insert
// Exclude from Application Evaluation

// If the new feature is not a water main, abort
if($feature.SubtypeField != "Water Main") { return }

// load all laterals
var laterals = Filter($featureset, "SubtypeField = 'Service'")

// load the valves
var valves = FeaturesetByName($datastore, "NameOfTheValveFeatureclass")

// get the new feature's end point
var end_point = Geometry($feature).paths[-1][-1]

// if the new feature doesn't end at a valve, abort
var valves_at_end_point = Intersects(valves, end_point)
var valve = First(valves_at_end_point)
if(valve == null) { return }

// if there already exists a lateral at the valve, abort
var laterals_at_valve = Intersects(laterals, valve)
if(First(laterals_at_valve) != null) { return }

// get the angle of the new feature at the valve
var waterline_clip = Clip($feature, Extent(Buffer(valve, 0.1)))
var wcp = waterline_clip.paths
var waterline_angle = Angle(wcp[0][0], wcp[-1][-1]) * PI / 180

// calculate the geometry of the lateral line
var lateral_length = 2
var lateral_start = Geometry(valve)
var lateral_end = Point({
    x: lateral_start.x + lateral_length * cos(waterline_angle),
    y: lateral_start.y + lateral_length * sin(waterline_angle),
    spatialReference: lateral_start.spatialReference
    })
var lateral_geometry = Polyline({
    paths: [[
        [lateral_start.x, lateral_start.y],
        [lateral_end.x, lateral_end.y],
        ]],
    spatialReference: lateral_start.spatialReference
    })

// save the lateral and the plug
return {
    edit: [
        {
        className: "NameOfThePlugFeatureclass",
        adds: [{geometry: lateral_end, attributes: {SubtypeField: "Plug"}}]
        },
        {
        className: "WaterLine",
        adds: [{geometry: lateral_geometry, attributes: {SubtypeField: "Service"}}]
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to supply the correct names of the feature classes, field names and subtypes in lines&amp;nbsp;7, 10, 13, 52, 53, 56, 57.&lt;/P&gt;&lt;P&gt;Line 33: This creates a 2 &lt;STRONG&gt;meter&lt;/STRONG&gt; lateral in my test feature class. Try it with your data, maybe it works correctly there. Else you have to replace that with the metric value (2 feet =&amp;nbsp;0,6096 meters)&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 10:46:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1249400#M6467</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-19T10:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade Attribute Rule To Insert Lines after Points</title>
      <link>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1249771#M6468</link>
      <description>&lt;P&gt;Thank you, Johannes! I will test first thing in the morning and let you know how it works.&lt;/P&gt;&lt;P&gt;I appreciate your time and support. Have a great day ahead.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 00:12:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/using-arcade-attribute-rule-to-insert-lines-after/m-p/1249771#M6468</guid>
      <dc:creator>Cash_E</dc:creator>
      <dc:date>2023-01-20T00:12:09Z</dc:date>
    </item>
  </channel>
</rss>

