<?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: Dynamically counting points in Polygons in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/1089958#M74320</link>
    <description>&lt;P&gt;I would also like to do this but I would like it to display as dynamic text in an ArcPro layout. I am currently using a Count function to display the number of points in my layout but I need it to count the number of points that fall within the polygon in my layout.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Aug 2021 14:54:43 GMT</pubDate>
    <dc:creator>SarahHartholt</dc:creator>
    <dc:date>2021-08-18T14:54:43Z</dc:date>
    <item>
      <title>Dynamically counting points in Polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/141736#M13182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;I have a fairly large points layer in a hosted feature service - Lets call this &lt;STRONG&gt;incidents&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;This layer is frequently changing every couple of minutes with new&amp;nbsp;records, deletes and updated locations.&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;I have a polygon layer as a hosted feature service - lets call this &lt;STRONG&gt;districts&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;A static layer that never changes shape.&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;This is &lt;STRONG&gt;all in ArcGIS Online.&lt;/STRONG&gt;&amp;nbsp; No ArcGIS Enterprise in the mix.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a user, I want to have a count of how many points there are in each polygon, along with perhaps some summary stats on the numerical fields from the incidents layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With a DBMS + ArcGIS Enterprise, I could create a nice Query layer and leverage ST_Intersects to have the polygons dynamically count how many features there are within them.&amp;nbsp; But, I don't have access to these for this project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was looking&lt;A href="https://developers.arcgis.com/arcade/function-reference/geometry_functions/#contains"&gt; at Arcade&lt;/A&gt;, but does not look like this is possible to reference a separate layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was also looking at the Geometry Engine and t&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#contains"&gt;he Contains method on a polygon&lt;/A&gt; in the Esri Javascript API (custom front-end logic is fine).&amp;nbsp; This sounds client-heavy.&amp;nbsp; I would have to send all incidents to the browser and then loop through each incident that is contained in each district to tally up scores, and then render.&amp;nbsp; But, could be an option here.&amp;nbsp; &lt;SPAN style="font-size: 11px;"&gt;Could do with a sample snippet or pseudocode as a headstart...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is the &lt;A href="https://doc.arcgis.com/en/arcgis-online/analyze/join-features.htm"&gt;Spatial Join analysis tool,&lt;/A&gt; but the frequency this would need to be run (every couple of minutes) going to burn through my credits allowance fairly quick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Anyone want to brainstorm this a little and offer a better suggestion I might not have thought of?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A Python funtion running every couple of minutes on AWS Lambda every with some non-arcpy libraries that perform the counts/summary stats?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 14:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/141736#M13182</guid>
      <dc:creator>SimonJackson</dc:creator>
      <dc:date>2018-10-30T14:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically counting points in Polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/141737#M13183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Why not just to a simple query on the map service for each district using a queryTask?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 00:06:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/141737#M13183</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-10-31T00:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically counting points in Polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/141738#M13184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the moment, I am investigating the use of doing this with a view.&amp;nbsp; That way the crunching can be done server-side and looks like it won't incurr any credits.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://doc.arcgis.com/en/arcgis-online/manage-data/set-view-definition.htm" title="https://doc.arcgis.com/en/arcgis-online/manage-data/set-view-definition.htm"&gt;Set hosted feature layer view definition—ArcGIS Online Help | ArcGIS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will report back my findings...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 00:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/141738#M13184</guid>
      <dc:creator>SimonJackson</dc:creator>
      <dc:date>2018-10-31T00:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically counting points in Polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/1040222#M72180</link>
      <description>&lt;P&gt;Hi Simon,&lt;/P&gt;&lt;P&gt;Were you ever able to find a solution to this problem?&amp;nbsp; I am wanting to do something similar and have yet to find a solid answer on this.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 15:25:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/1040222#M72180</guid>
      <dc:creator>seanchambers1</dc:creator>
      <dc:date>2021-03-24T15:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically counting points in Polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/1089958#M74320</link>
      <description>&lt;P&gt;I would also like to do this but I would like it to display as dynamic text in an ArcPro layout. I am currently using a Count function to display the number of points in my layout but I need it to count the number of points that fall within the polygon in my layout.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 14:54:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamically-counting-points-in-polygons/m-p/1089958#M74320</guid>
      <dc:creator>SarahHartholt</dc:creator>
      <dc:date>2021-08-18T14:54:43Z</dc:date>
    </item>
  </channel>
</rss>

