<?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 expression cut function in popup - how to use? in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1310436#M53487</link>
    <description>&lt;P&gt;Oh, that's just a placeholder. You'd use the name of your actual layer from the map. In the expression builder, you should be able to see a list of available variables, and your other map layers should be there.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2023 13:16:33 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2023-07-21T13:16:33Z</dc:date>
    <item>
      <title>Arcade expression cut function in popup - how to use?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1309348#M53440</link>
      <description>&lt;P&gt;Hello, I am trying to do something very simple (I thought), just to run a cut tool in a popup to show a reduced acreage value based on stream buffers with an arcade expression. I just don't understand how to reference the cutting layer in the expression. I've tried many things and went down the featureclassasID rabbit hole, but I just can't get to it. It's in the same map as the layer I'm trying to cut.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 02:39:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1309348#M53440</guid>
      <dc:creator>CharlescobBailey</dc:creator>
      <dc:date>2023-07-19T02:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression cut function in popup - how to use?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1309492#M53447</link>
      <description>&lt;P&gt;Cut is meant to use a &lt;EM&gt;single line feature &lt;/EM&gt;to cut a polygon or line, and to then return all the resulting pieces.&lt;/P&gt;&lt;P&gt;Your description sounds more like &lt;A href="https://developers.arcgis.com/arcade/function-reference/geometry_functions/#intersection" target="_blank"&gt;Intersection&lt;/A&gt;, where you want the overlap between two geometries, and you don't really care about retaining the non-intersecting area. Is that right?&lt;/P&gt;&lt;P&gt;Even if you're using Intersection, though, you'll have to somehow identify &lt;EM&gt;which &lt;/EM&gt;feature to use for the clip. You can't simply call up the whole stream layer. Typically, you'd use &lt;STRONG&gt;Intersects&lt;/STRONG&gt; to first find the intersecting feature, then the result of that would be used in the overlay tool.&lt;/P&gt;&lt;P&gt;Since you want to incorporate a &lt;EM&gt;buffer&lt;/EM&gt;, too, things get slightly more complicated. &lt;STRONG&gt;Buffer&lt;/STRONG&gt; also works against a single feature, not a FeatureSet, so you'd need to know &lt;EM&gt;which &lt;/EM&gt;stream features to buffer. But we can run our intersection using a buffer of the &lt;EM&gt;input feature&lt;/EM&gt; to identify streams that, when buffered, will clip the original feature.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// stream layer
var streams = FeatureSetByName($map, 'streams_layer')

// buffer distance, units; not really necessary to establish as own var, but since we're going to reference it more than once, we might as well, just in case you need to change it later
var buff = {
  'dist': 15,
  'unit': 'miles'
}

// get streams w/in your buffer
var xs_fs = Intersects(
  Buffer($feature, buff['dist'], buff['unit']),
  streams
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, this will give us a FeatureSet &lt;STRONG&gt;xs_fs&lt;/STRONG&gt;, consisting of the streams that will clip our feature. Another problem you may run into is that your feature may intersect with &lt;EM&gt;multiple &lt;/EM&gt;features. Or it may intersect with &lt;EM&gt;none&lt;/EM&gt;. So we want to make sure that what we're doing can accommodate any number of features.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// create acreage var for output; start at 0
var xs_acreage = 0.0

// iterate over intersecting stream features; within the loop, we'll have access to individual features for overlay operations
for (var x in xs_fs) {
  // buffer stream
  var stream_buff = Buffer(x, buff['dist'], buff['unit'])

  // clip original feature
  var feat_clip = Intersection($feature, stream_buff)

  // calculate acreage of intersection
  var clip_ac = Area(feat_clip, 'acres')

  // add calculated acreage to total
  var xs_acreage += clip_ac
}

return xs_acreage&lt;/LI-CODE&gt;&lt;P&gt;This way, if there are no intersecting features, you get a 0, and if there were 20, you'd get the total acreage of all of them.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 13:36:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1309492#M53447</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-07-19T13:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression cut function in popup - how to use?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1310290#M53481</link>
      <description>&lt;P&gt;Thanks so much for your response. I'm fair with Arcade but this is at the very edge of my understanding. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; One more question - in line 2 when you define the feature set, where is that name coming from? Is it the actual name of the FC or the name of the layer in the map? I couldn't get anything to work with this to get the cutting layer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 00:27:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1310290#M53481</guid>
      <dc:creator>CharlescobBailey</dc:creator>
      <dc:date>2023-07-21T00:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression cut function in popup - how to use?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1310436#M53487</link>
      <description>&lt;P&gt;Oh, that's just a placeholder. You'd use the name of your actual layer from the map. In the expression builder, you should be able to see a list of available variables, and your other map layers should be there.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 13:16:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cut-function-in-popup-how-to-use/m-p/1310436#M53487</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-07-21T13:16:33Z</dc:date>
    </item>
  </channel>
</rss>

