Hello All,
I have written a bit or arcade (I'm by no means a developer) that currently identifies features within a buffer and puts them in an array. From there I identify the Top 4 features that get pulled.
I'm struggling to 1) sort or OrderBy 'DESC' the resulting four features based on the distance (dist) and 2) limit the output to 3 decimal places.
I have attached the code below and the current result.
var intersectsLayer = Intersects(FeatureSetByName($map, "InventoryIntersects"),buff)
var devList =[]
for (var f in intersectsLayer){
var dName = f.Development_Name
var dist = DistanceGeodetic(f,$feature,'mile')
var distNum = Number(dist)
var distFull = distNum + " miles to the nearest property " + dName
Push(devList, distFull)
}
var topProps = Top(devList, 4)
return topProps
Result:
0: "0 miles to the nearest property El Patrimonio Apartments"
1: "1.144445981353735 miles to the nearest property Padre De Vida Apartments"
2: "3.2777811013923253 miles to the nearest property Villas at Beaumont"
3: "2.470305385835081 miles to the nearest property Uvalde Villas"