Pull features where clicked when using Arcade Intersects

503
3
08-07-2020 10:51 AM
DaveK
by
Occasional Contributor

Hello! 

I'm using the Arcade Intersects function to pull intersecting layer information and place it within a popup. I've come across a situation where multiple polygons (red border) from one layer intersect my main layer (yellow squares) and the popup only returns a single feature. Is it possible to pull the intersecting feature information where clicked on the map? 

Example: The eastern side of the red line is zone 13 and the western side is zone 36. When clicked only the zone 13 information is populated within the popup. Is it possible to pull the information from the intersecting layer where clicked on the map? 

Arcade Expression: 

var intersectLayer = Intersects(FeatureSetByName($map,"Deer Management Zones"), $feature)

for (var f in intersectLayer){
return text(f.DMZ)
}$map

Thanks! 

Tags (2)
0 Kudos
3 Replies
XanderBakker
Esri Esteemed Contributor

Hi David Krady ,

When you configure an Arcade expression for a pop-up that should appear when clicking on a feature, you do not have access the actual location where the user clicked. You will only have the clicked feature geometry and not the exact location. (I hope this will be provided at some point in the future).

In your case the expression contains a loop and you use the return inside the loop. When the sequence hits the return, it will exit the arcade expression. So, you will only have the first feature (attribute) it found in the process.  To return multiple features, you will need to use a variable that you populate with the results and return that variable after the loop.

Have a look at the example below:

var intersectLayer = Intersects(FeatureSetByName($map, "Deer Management Zones"), $feature);
var cnt = Count(intersectLayer);
var result = "DMZ(s) found:"

// first check if you have any intersecting features
if (cnt > 0) {
    for (var f in intersectLayer){
        result += TextFormatting.NewLine + " - " + f.DMZ;
    }
} else {
    result = "no DMZs found..."
}

return result;
0 Kudos
DeborahDAVID
New Contributor II

Hi @XanderBakker , 

One year later, do you know if the function of clicking on a feature can access to the XY location of the point now existing ?

I would like to have a pop-up in which I can return the information of the layers that intersects this point of identification.

Thanks for your answer

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @DeborahDAVID ,

From what I have seen we still don't have this functionality in Arcade today, but I agree with you that it would be great to have. 

0 Kudos