Arcade - Intersecting a flood polygon with a suburb polygon return the name of the suburb

444
4
10-07-2021 02:26 AM
Labels (1)
Greta
by
New Contributor III

HI 

I have a flood layer and a suburb layer. I wrote an Arcade code in the flood layer so when click returns the information  of the flood and the name of the suburb

var intersectLayer = Intersects($feature, FeatureSetByName($map,"Suburb"))
for(var f in intersectLayer){
return f.SuburbName
}

But the result in the pop up always has the same suburb name "Suburb 2". I appreciate any help. Thanks

Greta_1-1633598658188.png

 

 

 

 

0 Kudos
4 Replies
JohannesLindner
MVP Regular Contributor

You return the first intersected suburb. If a flood feature intersects multiple suburbs (eg su2 and su3), the expression will only return su2. 

Try this:

var intersectLayer = Intersects($feature, FeatureSetByName($map,"Suburb"))
var suburbs = []
for(var f in intersectLayer){
  Push(suburbs, f.SuburbName)
}
return Concatenate(suburbs, ", ")

 

 


Have a great day!
Johannes
Greta
by
New Contributor III

Thanks, Joanes, for your reply, I tested the code, and it gave me the name of all the suburbs that intersect the flood, Are there any way that if my flood intersects several suburbs, but I click in a specific suburb, only return the name of that suburb?

0 Kudos
JohannesLindner
MVP Regular Contributor

Not really. Arcade doesn't know where you clicked, just on which feature.

You could disable popups for the flood layer and do all the flood related code in the suburb layer.


Have a great day!
Johannes
0 Kudos
Greta
by
New Contributor III

Thank you

0 Kudos