<?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: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115440#M42900</link>
    <description>&lt;P&gt;I recently attended an Analysis MOOC and they described a way to create features based on overlay analysis.&amp;nbsp; I think it is only available in the Map Viewer Classic. Could be an option.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 21:55:19 GMT</pubDate>
    <dc:creator>ABishop</dc:creator>
    <dc:date>2021-11-09T21:55:19Z</dc:date>
    <item>
      <title>How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115414#M42894</link>
      <description>&lt;P&gt;There is a hosted feature layer that ESRI produces of Live Stream Gauges (&lt;A href="https://www.arcgis.com/home/item.html?id=81c5a9f2a2704d54a49042a44eefa5d3" target="_blank" rel="noopener"&gt;https://www.arcgis.com/home/item.html?id=81c5a9f2a2704d54a49042a44eefa5d3&lt;/A&gt;&amp;nbsp;) with just under 30,000 gauges from around the world which is updated hourly. I've set up a Dashboard to help show what areas are flooding in my specific Area of Interest (My AOI has 515 gauges). The extent of my AOI is not a regular square/rectangle, so no basic extent filtering. To give you a sense of my AOI it covers several portions of some states but not entire states. I'm not an Admin of that data so cannot create Hosted Feature Views.&lt;/P&gt;&lt;P&gt;I created a local copy of the data that I can match as Layer Actions in my Dashboard for lists of Gauges in my AOI (so folks can select which hydrograph they want to see). Though I can't figure out a way to filter the Live Stream Gauges to only show the 515 gauges my work cares about. Also, without this filtering the Indicators for Major Flooding or Minor Flooding include gauges in the same states as my AOI but outside my AOI itself&lt;/P&gt;&lt;P&gt;I've tried many workarounds and the best one seems to be moving it all to AGOL and using Data Expressions or Arcade to limit either the features shown in the map or in each individual indicator. I'm coming across an issue with my Arcade in an Indicator (I've removed several of the coordinates for brevity) :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;var outerGeom = Polygon({&lt;BR /&gt;"rings": [ [[-73.95324012956144,40.122201568981296],&lt;BR /&gt;[-71.82532762791266,40.98483831123638],&lt;BR /&gt;[-71.92829333485861,41.2400142610767],&lt;BR /&gt;[-73.61331393113787,40.94986225060882],&lt;BR /&gt;[-74.533824004194,40.99513394964706],&lt;BR /&gt;[-75.01685781914264,40.66418261919473],&lt;BR /&gt;[-74.78762813590278,40.31578492218021],&lt;BR /&gt;[-73.95324012956144,40.122201568981296]] ],&lt;BR /&gt;"spatialReference": { "wkid": 4617 }&lt;BR /&gt;});&lt;BR /&gt;Count( Within(outerGeom, $layer));&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;//textColor:'',&lt;BR /&gt;//backgroundColor:'',&lt;BR /&gt;//topText: '',&lt;BR /&gt;//topTextColor: '',&lt;BR /&gt;//topTextOutlineColor: '',&lt;BR /&gt;//topTextMaxSize: 'medium',&lt;BR /&gt;middleText: $datapoint["count"],&lt;BR /&gt;middleTextColor: '',&lt;BR /&gt;middleTextOutlineColor: '',&lt;BR /&gt;middleTextMaxSize: 'large',&lt;BR /&gt;//bottomText: '',&lt;BR /&gt;//bottomTextColor: '',&lt;BR /&gt;//bottomTextOutlineColor: '',&lt;BR /&gt;//bottomTextMaxSize: 'medium',&lt;BR /&gt;//iconName:'',&lt;BR /&gt;//iconAlign:'left',&lt;BR /&gt;//iconColor:'',&lt;BR /&gt;//iconOutlineColor:'',&lt;BR /&gt;//noValue:false,&lt;BR /&gt;//attributes: {&lt;BR /&gt;// attribute1: '',&lt;BR /&gt;// attribute2: ''&lt;BR /&gt;// }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I keep getting the error "&lt;SPAN class=""&gt;Parse Error:&lt;/SPAN&gt;&lt;SPAN&gt;polygon is not available" when I click on Test. Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Alternately any other ideas on how to filter/clip/mask the gauge points to my AOI in the map itself which would solve this issue.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:01:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115414#M42894</guid>
      <dc:creator>MatthewDavis1984</dc:creator>
      <dc:date>2021-11-09T21:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115420#M42895</link>
      <description>&lt;P&gt;Hello Matthew,&lt;/P&gt;&lt;P&gt;Does your AOI change?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:10:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115420#M42895</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-09T21:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115438#M42899</link>
      <description>&lt;P&gt;Hello Amanda,&lt;/P&gt;&lt;P&gt;No, the AOI is a fixed polygon&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:52:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115438#M42899</guid>
      <dc:creator>MatthewDavis1984</dc:creator>
      <dc:date>2021-11-09T21:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115440#M42900</link>
      <description>&lt;P&gt;I recently attended an Analysis MOOC and they described a way to create features based on overlay analysis.&amp;nbsp; I think it is only available in the Map Viewer Classic. Could be an option.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:55:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115440#M42900</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-09T21:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115447#M42901</link>
      <description>&lt;P&gt;Thanks for the suggestion! Unfortunately since the data is 'Live' and updated hourly any attempt to create some kind of Join or View or Overlay would result in a static dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:04:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115447#M42901</guid>
      <dc:creator>MatthewDavis1984</dc:creator>
      <dc:date>2021-11-09T22:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115533#M42904</link>
      <description>&lt;P&gt;The code seems to be OK, no idea why it would throw that error. Maybe try this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;create and publish a feature class with that polygon&lt;/LI&gt;&lt;LI&gt;use Intersects:&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;var aoi = FeatureSetByName($datastore, "AoiPolygonFC", ["*"], true)
var gauges_in_aoi = Intersects(aoi, $layer)
Count(gauges_in_aoi)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Personally, I would use a definition query on the layer, so only "your" gauges are shown to begin with. Get the STATION attributes of the gauges in your aoi, construct the SQL as&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;STATION IN ('US04229500', 'NWSCOSN6', 'US01187300', ...)&lt;/LI-CODE&gt;&lt;P&gt;and use that to filter your layer. Manually, that would be lots of work (and error prone). If you have access to ArcMap/ArcGIS Pro, it's easy:&lt;/P&gt;&lt;P&gt;Load the gauge layer, select your gauges, edit and run this code in the python window:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cursor = arcpy.da.SearchCursor("Gauge_Layer", ["STATION"])
stations = [row[0] for row in cursor]
print("STATION IN ('{}')".format("', '".join(stations)))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Nov 2021 07:49:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115533#M42904</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-11-10T07:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115611#M42907</link>
      <description>&lt;P&gt;Hi Johannes,&lt;/P&gt;&lt;P&gt;Thanks for the input! I'm trying your first suggestion though am getting a "SpatialReference" error which I'll have to dig into. The second two options you put forward I already did to create the Reference layer (it is used to narrow down the two List elements in my Dashboard to only show those in the area we are interested in). Here is a screenshot of the Dashboard:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dashboard_Screenshot.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27133iD6A8A7C92C20B88B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dashboard_Screenshot.jpg" alt="Dashboard_Screenshot.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the above screenshot the one "Minor Flood" indicator is showing outside of our AOI. I'm hoping to either limit the points in the map itself to our AOI (right now they are only filtered by State), or limit the indicator to the points within our AOI. (Uploading another feature service as a reference layer negates the live updates from the ESRI Live Stream Gauges hosted feature service; I can use it as a reference layer but I need to narrow down the Live layer itself so we can get continuous updates, especially during storm events).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the Portal Map that is the basis for this Dashboard I tried manually filtering by stations, but there seemed to be an error where it won't hold more than 125 filters at once (my AOI has 500+ gauges)&lt;/P&gt;&lt;P&gt;Does this help?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 13:14:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1115611#M42907</guid>
      <dc:creator>MatthewDavis1984</dc:creator>
      <dc:date>2021-11-10T13:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1337583#M55055</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/513204"&gt;@MatthewDavis1984&lt;/a&gt;&amp;nbsp;- what strategy did you end up using for filtering the map? What I've come to is using the "Custom Parameters" option in the underlying Map Viewer to query the live data set. It seems clunky as I have to paste in all the coordinates of the polygons with the "ring" syntax used in the ArcGIS Rest API....&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 02:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1337583#M55055</guid>
      <dc:creator>JJ_Reyes</dc:creator>
      <dc:date>2023-10-13T02:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter/limit points within a polygon (or in indicators) on AGOL/Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1338165#M55087</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/466941"&gt;@JJ_Reyes&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish I could say that that would work, but my AOI has 59,028 vertices and trying to use custom parameters to filter it out would take forever. Though maybe a generalized AOI with fewer vertices would do the trick?&lt;/P&gt;&lt;P&gt;I ended up doing a 'manual' method. I did a spatial select to get the ~515 gauge locations in my AOI, building a list with them, then manually filtering out only those ~515 gauges in the map filter option on the layer itself. This had additional issues in that building the filters in Chrome tended to stop accepting new filters after every ~20 filters or so. I eventually learned that this issue doesn't happen in Firefox or Edge so performed the rest of the filters there.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatthewDavis1984_0-1697458142122.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/83133iD44F5487FBC2978A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MatthewDavis1984_0-1697458142122.png" alt="MatthewDavis1984_0-1697458142122.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 12:17:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-use-arcade-to-filter-limit-points-within-a/m-p/1338165#M55087</guid>
      <dc:creator>MatthewDavis1984</dc:creator>
      <dc:date>2023-10-16T12:17:02Z</dc:date>
    </item>
  </channel>
</rss>

