<?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 Data Expression - Intersects for Dashboard List in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265461#M50746</link>
    <description>&lt;P&gt;Thanks Josh, I am slowly trying to digest the information in your link! Do you know if the Contains function is applicable to points intersecting lines? I am struggling to find any alternatives for a "spatial join" type function.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 14:55:41 GMT</pubDate>
    <dc:creator>RyanElvrum5</dc:creator>
    <dc:date>2023-03-08T14:55:41Z</dc:date>
    <item>
      <title>Arcade Data Expression - Intersects for Dashboard List</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265441#M50743</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create a Data Expression to be used in a Dashboard List widget. My arcade expression is attempting to perform an intersect for each point feature in my FeatureSet to check if it intersects with a line in a different FeatureSet.&lt;BR /&gt;&lt;BR /&gt;My understanding is that the Intersect needs to be performed on 1 input feature at a time, so I feel like some type of loop needs to occur. I then want to return all the point features that intersect a line as a FeatureSet to be used in the List widget. I believe this should be possible, but I think I am stuck at creating a For-in loop to perform an intersect for each point feature and store the results to be returned as a FeatureSet. Below is what my code looks like so far. Everything down to line 24 works, so I do not believe I have any issues up until that point. Everything after line 24 is where I am getting lost.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;//Portal
var port = "Https://www.arcgis.com"
//ArcGIS Online item ID
var itemID = "4c82c3b6b8d64c6ca0ecd20d813531f2"
//Rest layer ID - Storm Gravity Mains
var GMlayerID = 60
//Rest layer ID - Storm Manholes
var MHlayerID = 57
//Fields returned - All (Default)
var fields = ['*']
//Geometry returned
var geo = True
//Set up Gravity Main feature set
var fsGM = FeatureSetByPortalItem(Portal(port), itemId, GMlayerID, fields,geo)
//Set up Manhole feature set
var fsMH = FeatureSetByPortalItem(Portal(port), itemId, MHlayerID, fields,geo)
//Filter statement used to filter feature set down to Gravity Mains with an upsteam invert value that is less than downstream invert value
var FilterStatementGM = "UpstreamInvert &amp;lt; DownstreamInvert AND TrunkMain = 'Y'"
//Returns filtered Gravity Mains
var filteredfsGM = Filter(fsGM, FilterStatementGM)
//Filter statement used to filter feature set down to Gravity Mains with an upsteam invert value that is less than downstream invert value
var FilterStatementMH = "TrunkMain = 'Y' AND NeedsGPS = 1 AND MajorDBDistrict = 'J'"
//Returns filtered Manholes
var filteredfsMH = Filter(fsMH, FilterStatementMH)
var MHlist = ''
for (var f in filteredfsMH){
  Intersects(f, filteredfsGM)
    MHlist += f.FacilityID
}
return MHlist&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 14:24:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265441#M50743</guid>
      <dc:creator>RyanElvrum5</dc:creator>
      <dc:date>2023-03-08T14:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression - Intersects for Dashboard List</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265449#M50745</link>
      <description>&lt;P&gt;There is an example expression that performs a "spatial join" between two layers, which you can access right here: &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/SpatialAggregation.md" target="_blank"&gt;https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/SpatialAggregation.md&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 14:33:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265449#M50745</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-03-08T14:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression - Intersects for Dashboard List</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265461#M50746</link>
      <description>&lt;P&gt;Thanks Josh, I am slowly trying to digest the information in your link! Do you know if the Contains function is applicable to points intersecting lines? I am struggling to find any alternatives for a "spatial join" type function.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 14:55:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265461#M50746</guid>
      <dc:creator>RyanElvrum5</dc:creator>
      <dc:date>2023-03-08T14:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Data Expression - Intersects for Dashboard List</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265494#M50750</link>
      <description>&lt;P&gt;Josh, thanks again for providing the link. I pretty much have it working now. I am able to return a list of features, and I was able to use the Intersects()&amp;nbsp;function to do so.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The only thing I want to look into more deeply is, if instead of "creating" a new feature (list?/array?/object?) for the output, I'd rather return a FeatureSet of the actual features so that I may use the List widget Action: Zoom to Feature. I want the users to be able to select an item in the list and zoom directly to it. I will come back and update this thread if I can figure that out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;//Portal
var port = "Https://www.arcgis.com"
//ArcGIS Online item ID
var itemID = "4c82c3b6b8d64c6ca0ecd20d813531f2"
//Rest layer ID - Storm Gravity Mains
var GMlayerID = 60
//Rest layer ID - Storm Manholes
var MHlayerID = 57
//Fields returned - All (Default)
var fields = ['*']
//Geometry returned
var geo = True
//Set up Gravity Main feature set
var fsGM = FeatureSetByPortalItem(Portal(port), itemId, GMlayerID, fields,geo)
//Set up Manhole feature set
var fsMH = FeatureSetByPortalItem(Portal(port), itemId, MHlayerID, fields,geo)
//Filter statement used to filter feature set down to Gravity Mains with an upsteam invert value that is less than downstream invert value
var FilterStatementGM = "UpstreamInvert &amp;lt; DownstreamInvert AND TrunkMain = 'Y'"
//Returns filtered Gravity Mains
var filteredfsGM = Filter(fsGM, FilterStatementGM)
//Filter statement used to filter feature set down to Gravity Mains with an upsteam invert value that is less than downstream invert value
var FilterStatementMH = "TrunkMain = 'Y' AND NeedsGPS = 1 AND MajorDBDistrict = 'J'"
//Returns filtered Manholes
var filteredfsMH = Filter(fsMH, FilterStatementMH)
var MHlist = [];
var MH;
for (var f in filteredfsMH){
  var m = Intersects(f, filteredfsGM);

  MH = {
    'attributes':{
      'facilityID': f['FacilityID'],
      'cnt': Count(m)
    }
  }
  Push(MHlist, MH);
};

var out_dict = {
  'fields':[
    {'name': 'facilityID', 'alias': 'FacilityID', 'type': 'esriFieldTypeString'},
    {'name': 'cnt', 'alias': 'Count', 'type': 'esriFieldTypeInteger'}
  ],
  'geometryType': '',
  'features': MHlist
};
return FeatureSet(Text(out_dict))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Mar 2023 15:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-data-expression-intersects-for-dashboard/m-p/1265494#M50750</guid>
      <dc:creator>RyanElvrum5</dc:creator>
      <dc:date>2023-03-08T15:52:58Z</dc:date>
    </item>
  </channel>
</rss>

