Hello,
I have a hosted feature layer on AGOL and would like to be able to present a list of the nearby points to any given point. I have found some very helpful info online which I have used to almost get the output I am looking for.
The output in the pop-up only gives some of the points that fall within a 3km buffer within the list, others that clearly area within that distance are not listed. The other issue is the list includes the points themselves.
Example - Point 1 is close to point 2 and point 3, but the pop-up list for point 1 shows point 1 within the list alongside point 2 omitting point 3 entirely.
Here is the code I have copied and edited from this online resource - Use Arcade geometry functions with FeatureSets to provide spatial context (esri.com)
var SNAPlayer = FeatureSetByName($map, "NPP Peatland sites")
var areabuff = Buffer($feature, 3000, "meters")
var siteswithin = Contains(SNAPlayer, areabuff)
var site_list = ""
for (var k in siteswithin)
{
site_list += k.Site_name + TextFormatting.NewLine
}
return site_list
The way I am understanding the above code is that I am defining the layer in the map then applying a 3000m buffer to the feature then creating a list of points from the layer that fall within the 3000m buffer.
Then creating a site list using the site name field as the output.
Any help on this would be appreciated.
Thanks,
Andy