<?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 Arcade Expression to intersect two featuresets and return count in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509603#M60474</link>
    <description>&lt;P&gt;I'm trying to make a popup expression that will buffer a line to select intersecting parcels, then return a count of points that are within that resulting featureset of parcels. This is my code representing what I'm attempting, but it seems you cannot intersect two featuresets. How should I go about this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var parcels = FeatureSetByName($map, "Parcels")
var sites = FeatureSetByName($map, "MHC Inventory Points")
var routes = $feature

//return all parcels within 200 feet of route
var int1 = Intersects(bufferGeodetic($feature, 200, "feet"), parcels)

//return featureset of sites that are within first intersection featureset
// this intersection is giving an execution error
var int2 = Intersects(sites, int1)

return count(int2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2024 20:43:32 GMT</pubDate>
    <dc:creator>AustinCanty1</dc:creator>
    <dc:date>2024-07-24T20:43:32Z</dc:date>
    <item>
      <title>Arcade Expression to intersect two featuresets and return count</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509603#M60474</link>
      <description>&lt;P&gt;I'm trying to make a popup expression that will buffer a line to select intersecting parcels, then return a count of points that are within that resulting featureset of parcels. This is my code representing what I'm attempting, but it seems you cannot intersect two featuresets. How should I go about this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var parcels = FeatureSetByName($map, "Parcels")
var sites = FeatureSetByName($map, "MHC Inventory Points")
var routes = $feature

//return all parcels within 200 feet of route
var int1 = Intersects(bufferGeodetic($feature, 200, "feet"), parcels)

//return featureset of sites that are within first intersection featureset
// this intersection is giving an execution error
var int2 = Intersects(sites, int1)

return count(int2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 20:43:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509603#M60474</guid>
      <dc:creator>AustinCanty1</dc:creator>
      <dc:date>2024-07-24T20:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression to intersect two featuresets and return count</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509636#M60475</link>
      <description>&lt;P&gt;That's correct, you cannot intersect two featuresets. Popup code is meant to evaluate on the specific clicked feature, not an entire layer. You &lt;EM&gt;can &lt;/EM&gt;write an expression that will do that, but it's not likely to perform very well. But who knows? Worth trying out.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var parcels = FeatureSetByName($map, "Parcels")
var sites = FeatureSetByName($map, "MHC Inventory Points")

//return all parcels within 200 feet of route
var int1 = Intersects(bufferGeodetic($feature, 200, "feet"), parcels)

//merge all intersected parcels into one big geometry
var p_geoms = []
for (var i in int1) {
  Push(p_geoms, Geometry(i))
}

var parcels_merged = Union(p_geoms)

// intersect merged parcels with sites
var int2 = Intersects(sites, parcels_merged)

return count(int2)

//return featureset of sites that are within first intersection featureset
// this intersection is giving an execution error
var int2 = Intersects(sites, int1)

return count(int2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 21:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509636#M60475</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-24T21:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression to intersect two featuresets and return count</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509649#M60478</link>
      <description>&lt;P&gt;Amazing! That works and with minimal loading time for the popup. Thanks Josh!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 22:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-intersect-two-featuresets-and/m-p/1509649#M60478</guid>
      <dc:creator>AustinCanty1</dc:creator>
      <dc:date>2024-07-24T22:01:45Z</dc:date>
    </item>
  </channel>
</rss>

