<?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: Using Arcade to Find the Nearest Address Point in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108746#M5176</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ I'm trying to do this where it is looking within the same feature class to find the closest group next to it.&amp;nbsp; I've made the silly mistake of using the above code however now it just references itself as being the nearest (which makes sense!) most of the time the distances are 0 (again good), but sometimes they aren't (which is weird).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I add a filter into the script so that it jumps over its own feature and only looks at the others within that layer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Nov 2019 09:09:27 GMT</pubDate>
    <dc:creator>NaomiBegg2</dc:creator>
    <dc:date>2019-11-06T09:09:27Z</dc:date>
    <item>
      <title>Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108741#M5171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a web map with a point layer representing manholes and a point layer representing addresses. I am attempting to create an Arcade expression that will display the nearest address point in the popup of a selected manhole. I'm trying to do this by creating a buffer around the selected manhole, calculating the distance of each address point intersecting the buffer, and returning the address of the nearest address point. No matter how I format the code below (I won't get into everything that I've tried&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;), I do get one address point, but it is neither the nearest or the farthest manhole. I have tried sorting, ordering, and using compare functions for the intersecting address points, but I don't seem to have access to the distance value in order to grab the closest one. Can anyone tell me if I'm going about this the right way or if this is even possible? Thanks in advance!!!&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var searchDist = 200;
var addresses = Intersects(FeatureSetById($map, "Primary_Address_3482"), Buffer( $feature, searchDist, "feet"));
var cnt = Count(addresses)
Console("Total Number of addresses within buffer: " + cnt);
var nearestaddress;
for (var f in addresses){
 var addressDist = Round(Distance(f, $feature, "feet"),2);
 Console(f.FULL_ADDR + ": " + " " + addressDist)
}

f.FULL_ADDR&lt;/PRE&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/461642_Results.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/461643_Console.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:01:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108741#M5171</guid>
      <dc:creator>PeterDalrymple</dc:creator>
      <dc:date>2021-12-12T16:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108742#M5172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/peter.dalrymple" target="_blank"&gt;peter.dalrymple&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are close. The distances are correctly reported to the console. The only thing you need is to get the nearest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; searchDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;200&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; addresses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;FeatureSetById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$map&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Primary_Address_3482"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Buffer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; searchDist&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"feet"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addresses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Total Number of addresses within buffer: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; nearestaddress&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; min_dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;250&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; addresses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; addressDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Distance&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"feet"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addressDist &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; min_dist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
     nearestaddress &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FULL_ADDR&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
     min_dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; addressDist&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
 &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FULL_ADDR &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;": "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; addressDist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; nearestaddress&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108742#M5172</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T06:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108743#M5173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌, that works great! I was struggling with that last bit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2019 19:23:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108743#M5173</guid>
      <dc:creator>PeterDalrymple</dc:creator>
      <dc:date>2019-10-11T19:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108744#M5174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/peter.dalrymple"&gt;peter.dalrymple&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm glad it worked. If you have any doubt, please let me know and I will provide some more explanation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2019 19:37:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108744#M5174</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-10-11T19:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108745#M5175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌,&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;Do you have any suggestions as to&amp;nbsp;how I might iterate the addresses chain, so that it grows the buffer if the cnt is less than 1? I've tried a couple of loops and if then statements, but the logic seems circular. Is this possible? Are there any examples you know of that could serve as a guide?&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Oct 2019 18:01:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108745#M5175</guid>
      <dc:creator>PeterDalrymple</dc:creator>
      <dc:date>2019-10-31T18:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108746#M5176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ I'm trying to do this where it is looking within the same feature class to find the closest group next to it.&amp;nbsp; I've made the silly mistake of using the above code however now it just references itself as being the nearest (which makes sense!) most of the time the distances are 0 (again good), but sometimes they aren't (which is weird).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I add a filter into the script so that it jumps over its own feature and only looks at the others within that layer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2019 09:09:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108746#M5176</guid>
      <dc:creator>NaomiBegg2</dc:creator>
      <dc:date>2019-11-06T09:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108747#M5177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/35812" target="_blank"&gt;Peter Dalrymple&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do that, but this could have a performance hit if you would have to do multiple buffers and intersects to get a result. Have you tried making the search distance larger instead?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is something you could try, although I haven't tested it and don't recommend doing this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; searchDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;200&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; maxloops &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; factor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; maxloops&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; addresses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;FeatureSetById&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$map&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Primary_Address_3482"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Buffer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; searchDist&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"feet"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addresses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Total Number of addresses within buffer: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; nearestaddress&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; min_dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; searchDist &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; addresses&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; addressDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Distance&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"feet"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addressDist &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; min_dist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
                nearestaddress &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FULL_ADDR&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
                min_dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; addressDist&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FULL_ADDR &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;": "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; addressDist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; nearestaddress&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;    
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    searchDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; searchDist &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; factor&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"no results..."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:33:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108747#M5177</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T06:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108748#M5178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/njbegg"&gt;njbegg&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you share the expression that you have at this moment?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2019 02:23:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108748#M5178</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-11-07T02:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108749#M5179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var searchDist = 150;&lt;BR /&gt;var IntersectClose = Intersects(Buffer($feature, 150, 'kilometers'), FeatureSetByName($map,"Girls Brigade groups - Stats"));&lt;BR /&gt;var cnt = Count(IntersectClose) &lt;BR /&gt;Console("Total Number of addresses within buffer: " + cnt);&lt;BR /&gt;var nearestGroup;&lt;BR /&gt;var min_dist = 200;&lt;BR /&gt;for (var f in IntersectClose){&lt;BR /&gt; var groupDist = Round(Distance(f, $feature, "kilometers"),2)&lt;BR /&gt; if (groupDist &amp;lt; min_dist) {&lt;BR /&gt; nearestGroup = f.USER_Group_Name;&lt;BR /&gt; min_dist = groupDist;&lt;BR /&gt; }&lt;BR /&gt;Console(f.USER_Group_Name + ": " + " " + groupDist)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return "Closest group is " + nearestGroup + ", " + groupDist + "km away."&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking that I need to out a second if statement similar to below.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;if (groupDist &amp;lt; min_dist) &amp;amp;&amp;amp; a.USER_Group_Name =! f.USER_Group_Name {&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However how do I distinguished&amp;nbsp;between the first group name and the second that appears within the for loop?&amp;nbsp; Do I need to declare it as another var at the start?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2019 02:33:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108749#M5179</guid>
      <dc:creator>NaomiBegg2</dc:creator>
      <dc:date>2019-11-07T02:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108750#M5180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/221930" target="_blank"&gt;Naomi Begg&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you could do something like this (see below). In this case you read out the object ID and only allow&amp;nbsp;a result in case it is a different object ID. You could also filter the feature set by&amp;nbsp;excluding this object id.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; currentOID &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;OBJECTID&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// assumig you have an object ID field&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; searchDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;150&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; IntersectClose &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Buffer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;150&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'kilometers'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$map&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Girls Brigade groups - Stats"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IntersectClose&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Total Number of addresses within buffer: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; nearestGroup&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; min_dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; searchDist &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; IntersectClose&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;OBJECTID &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; currentOID&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; groupDist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Round&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Distance&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"kilometers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;groupDist &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; min_dist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
                nearestGroup &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;USER_Group_Name&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
                min_dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; groupDist&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;USER_Group_Name &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;": "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; groupDist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Closest group is "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; nearestGroup &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;", "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; groupDist &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"km away."&lt;/SPAN&gt;        
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// no features found in buffer&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"No closest group found..."&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;


&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:33:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108750#M5180</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T06:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108751#M5181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That didn't work, but I'm not sure I could tell you exactly why. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp;Popup wants to return "no results..." even when there are intersecting features. I don't think I'll be going that route anyway, since the address result losses relevance&amp;nbsp;once it's that far away. Returning a coordinate or a message is probably more effective in that case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either way, it's informative to see how you would nest that logic. I haven't seen a lot of examples like that, so thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based upon your comments, I assume that performing multiple buffers and intersects is still less performant than returning and calculating distance for a 100-200 (or even 1000) feature list?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Nov 2019 19:47:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108751#M5181</guid>
      <dc:creator>PeterDalrymple</dc:creator>
      <dc:date>2019-11-08T19:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108752#M5182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/peter.dalrymple"&gt;peter.dalrymple&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thinks so. Basically since it will make multiple requests to the server and that will probably result in a lower performance. Too bad to hear that it doesn't work, but I agree, it would probably not be the way to go.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Nov 2019 22:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108752#M5182</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-11-08T22:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108753#M5183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌, I've got the query pulling out the correct group now.&amp;nbsp; However, the distance it is returning is not reliable.&amp;nbsp; I am getting two different results for groups that are right next to each other whereas they should return the same distance, and I am getting distances in the 100s when really they are 1km away.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Nov 2019 04:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108753#M5183</guid>
      <dc:creator>NaomiBegg1</dc:creator>
      <dc:date>2019-11-09T04:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108754#M5184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/171767"&gt;Naomi Begg&lt;/A&gt;&amp;nbsp;,&amp;nbsp;there is a note about the accuracy of the&amp;nbsp;geometries and subsequent analysis on them, related to the scale in which you retrieve the geometry. However, this does not explain the differences that you are seeing. You could try using "DistanceGeodetic", but I doubt that it will solve this issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Nov 2019 20:50:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/108754#M5184</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-11-09T20:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1176502#M46154</link>
      <description>&lt;P&gt;found this code today Xander... very few changes needed to make it work for me too.&amp;nbsp; **bleep** yes and thank you...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is mine, you can easily see how few changes were needed.&lt;/P&gt;&lt;P&gt;var searchDist = 200;&lt;BR /&gt;var addresses = Intersects(FeatureSetById($map, /* Jefferson County KY Address Points */ "OpenDataAddresses_7579"), Buffer($feature, searchDist, "feet"));&lt;BR /&gt;var cnt = Count(addresses)&lt;BR /&gt;Console("Total addresses within Buffer" + cnt);&lt;/P&gt;&lt;P&gt;var nearestaddress;&lt;BR /&gt;var min_dist = 250;&lt;BR /&gt;for (var f in addresses){&lt;BR /&gt;var addressDist = Round(Distance(f, $feature, "feet"),2);&lt;BR /&gt;if (addressDist &amp;lt; min_dist) {&lt;BR /&gt;nearestaddress = f.FULL_ADDRESS;&lt;BR /&gt;min_dist = addressDist;&lt;BR /&gt;}&lt;BR /&gt;Console(f.FULL_ADDRESS + ": " + " " + addressDist);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return nearestaddress;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 17:02:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1176502#M46154</guid>
      <dc:creator>ScottStepro1</dc:creator>
      <dc:date>2022-05-23T17:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1176568#M46156</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&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;Thank you for your help. I have tried using your code and ran into several weird issues. When I set min_dist to a value the result I get is null. This has lead me to set it to infinity as shown in this esri resource&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jssamples/popup_arcade_featureset.html" target="_blank"&gt;Find nearest features using Arcade expressions in a popup | ArcGIS API for JavaScript 3.40 | ArcGIS Developer&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;When I set to infinity I get a result but it is often not the nearest address distance wise. And it changes if I use a higher search distance which doesn't make sense. I also get large numbers for the address distances.&lt;/P&gt;&lt;P&gt;The $feature is being hosted in arcgisonline while the address points layer is a registered feature layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea as to what may be going wrong with my version? Thank you for your help again! &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="console_results.png" style="width: 709px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41974i9C3B8538798B8101/image-size/large?v=v2&amp;amp;px=999" role="button" title="console_results.png" alt="console_results.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="infinity_1.png" style="width: 694px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41976i30EA9E02150903AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="infinity_1.png" alt="infinity_1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="infinity_2.png" style="width: 746px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41977i6E9F28EDB5138F26/image-size/large?v=v2&amp;amp;px=999" role="button" title="infinity_2.png" alt="infinity_2.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nullval.png" style="width: 751px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/41978i35BBF3DF0C60CE60/image-size/large?v=v2&amp;amp;px=999" role="button" title="nullval.png" alt="nullval.png" /&gt;&lt;/span&gt;I have attached some photos for reference&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 18:53:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1176568#M46156</guid>
      <dc:creator>OliverSandoval_p</dc:creator>
      <dc:date>2022-05-23T18:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1179873#M46287</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/509261"&gt;@OliverSandoval_p&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry for the delay, but when I look at the distances that you get I wonder how big your feature is... Distances of 65M feet are about halfway around the globe.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use Infinity or the searchDist as the initial minimum distance it will return the same result:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1654278056439.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42733i6B57BFF973B04346/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1654278056439.png" alt="XanderBakker_0-1654278056439.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 17:41:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1179873#M46287</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2022-06-03T17:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1188524#M46753</link>
      <description>&lt;P&gt;hi &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;The issue ended up being the web map's web Mercator projection while the hosted feature layers were in NAD 1983. I had to reprojection the data needed because end users needed to have more than one basemap and I didn't have time to create a custom basemap.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply!&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 23:45:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1188524#M46753</guid>
      <dc:creator>OliverSandoval_p</dc:creator>
      <dc:date>2022-06-30T23:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1562985#M62583</link>
      <description>&lt;P&gt;Just wanted to say that I was really happy to come across this expression as it did exactly what I wanted. I had to make two changes to get it to run so I wanted to share them in case others are having the same issues (this may be due to my lack of experience with arcade, but it worked!).&lt;BR /&gt;&lt;BR /&gt;1. I had to change from featuresetbyid to featuresetbyname&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. update the count function to reference the layer name from from var addresses : var cnt = Count(addresses) to var cnt = Count("Primary_Address_3482")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;My successful expression:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;searchDist&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;25&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;addresses&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Intersects&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$map&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"ADDRESS_gdb"&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;Buffer&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;searchDist&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"meters"&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;cnt&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Count&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"ADDRESS_gdb"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"Total Number of addresses within buffer: "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;cnt&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;nearestaddress&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;min_dist&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;35&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;f&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;addresses&lt;/SPAN&gt;&lt;SPAN&gt;){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;addressDist&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Round&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Distance&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"meters"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;addressDist&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;min_dist&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;nearestaddress&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ADDRESS&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;min_dist&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;addressDist&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ADDRESS&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;": "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;" "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;addressDist&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;nearestaddress&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Nov 2024 13:04:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1562985#M62583</guid>
      <dc:creator>ShannonJ</dc:creator>
      <dc:date>2024-11-27T13:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to Find the Nearest Address Point</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1591265#M63870</link>
      <description>&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 16:52:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point/m-p/1591265#M63870</guid>
      <dc:creator>DerekBernard</dc:creator>
      <dc:date>2025-03-03T16:52:43Z</dc:date>
    </item>
  </channel>
</rss>

