Select to view content in your preferred language

Pull features where clicked when using Arcade Intersects

2213
7
08-07-2020 10:51 AM
DaveK
by
Frequent 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
7 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
Occasional Contributor

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
RaimonReventós
Emerging Contributor

A year after @DeborahDAVID post ESRI still hasn't solved this basic functionality? Any reason?

is possible, using Arcade, emulate the IDENTIFY command (as in ArcMap, MapObjects, ArcView 3.x...) but instead of using the object $feature show in a POP-UP the field values of the visible layers at location where the user has clicked on the map?

Thnks

 

XanderBakker
Esri Esteemed Contributor

Hi @RaimonReventós ,

Almost a year ago I posted an idea (internally) with the title "Provide the location clicked in the pop-up to the Arcade expression". However, the idea is still open... 

RaimonReventós
Emerging Contributor

Thanks for your answer, I`ll try to work in a solution

0 Kudos
MK13
by
Frequent Contributor

@RussRoberts @EmilyGeo @bbollin  has this functionality been implemented yet?

0 Kudos