Arcade - Pull Attributes From Multiple Layers In Map

1025
2
04-06-2021 02:29 PM
RonParis
Occasional Contributor

I have a layer in my map (point layer), and I am trying to pull attributes from other layers in the same map (these layers are a combination of point, lines and polygon). I am currently using the below expression to pull through the attributes:

var intersectLayerWoodlandAsset =Intersects(Buffer($feature, 0.5, 'meters'),FeatureSetByName($map,"Woodland Asset"))

for (var f in intersectLayerWoodlandAsset){
    return f.FAILURECLASS
}
var intersectLayerVergeAsset =Intersects(Buffer($feature, 0.5, 'meters'),FeatureSetByName($map,"Verge Asset"))

for (var f in intersectLayerVergeAsset){
    return f.FAILURECLASS
}
var intersectLayerVentShaftAsset =Intersects(Buffer($feature, 0.5, 'meters'),FeatureSetByName($map,"Vent Shaft Asset"))

for (var f in intersectLayerVentShaftAsset){
    return f.FAILURECLASS
}

 The issue I'm facing is that I only want to pull through the field from the given layer when it is only turned on in the map, because there are instances where features in the multiple layers overlap, and I want to be able to dictate which layer the attribute is pulled from.

I'm not sure if this is even possible or maybe I need to re-write the script, but any help is much appreciated!

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

This isn't possible in Arcade, unfortunately. The property of whether a layer is visible or not is defined in the map itself as opposed to the individual layer, where Arcade is operating.

That isn't to say that what you're aiming for isn't possible at all, however. But it would require a deep dive into a custom JavaScript map.

- Josh Carlson
Kendall County GIS
0 Kudos
DougBrowning
MVP Esteemed Contributor

Only thing I can think of is to have a drop down where the user specifies which layer to do the lookup on.  Then use that choice in your code to return the correct one.

Hope that helps

0 Kudos