Hello, I am trying to find nearest feature distance and display its attribute name through pop-ups using Arcade expression in the WebMap (Portal for ArcGIS).
I found below expression from the esri link;
How To: Display the Distance of the Nearest Point Feature Using an Arcade Expression in Po (esri.com)
I managed to configure pop-ups and display nearest distance, but I could not figure out how to display its attribute from the result of the nearest distance.
Below is my scenario:
Layer 1: BigArea (polygon) [with one field name called "HOUSING PROJECT NAME"]
Layer 2: Land Parcel (Polygon)
I want to display distance and HOUSING PROJECT NAME when I click to any Land Parcel layer. It could me adding another attribute field or using the same distance field.
My script I found and modified from ESRI as below:
var BigArea = FeatureSetByName($map,"BigArea");
var buf = Buffer($feature, 2000000, "meter");
var fs_filtered = Intersects(BigArea, buf);
var cnt = Count(fs_filtered);
var min_dist = 2000000;
if (cnt > 0) {
for (var f in fs_filtered) {
var dist = Distance($feature, f);
if (dist < min_dist) {
min_dist = dist;
}
}
}
return round(min_dist, 3);
Any suggestions are most welcome.
Regards
Zukh