I'm trying to create a list of lakes (polygon features) within a region (polygon feature) using the Intersect function and have it returned in the regions pop-up. This is what I have thus far, I think it's correct but it's not returning any values. I'm not getting any errors just no data returned. Can anyone see an issue with the expression or have an idea as to why nothing is being returned?
Thanks for any help!
var lakes = Intersects($feature, FeatureSetById($map,"Lake_Report_CRCA_2021_4_9384"))
var lakes_list = ''
for (var f in lakes_list)
{
lakes_list += f.OFFICIAL_N + TextFormatting.NewLine
}
return lakes_list
Solved! Go to Solution.
Found the problem. My for loop referenced lakes_list when it should be the lakes variable. I decided to use the Contains function instead of Intersects. Thanks for the help!
var lakes = Contains($feature,FeatureSetByName($map,"Lake Report 2021"))
var lakes_list = []
for (var f in lakes){
Push(lakes_list, f.OFFICIAL_N)
}
return Concatenate(lakes_list, '\n')
No ideas why nothing's being returned, but a suggestion:
Create an array to hold your lake values, then use Concatenate to format your output string. Keeps from having an extra newline character when there's only one value.
var lakes_list = []
for (var f in lakes_list){
Push(lakes_list, f.OFFICIAL_N)
}
return Concatenate(lakes_list, '\n')
It is weird that didn't produce an error. I fixed it but it still doesn't return anything... I tried to use Count on the lakes variable and got an execution error.
Found the problem. My for loop referenced lakes_list when it should be the lakes variable. I decided to use the Contains function instead of Intersects. Thanks for the help!
var lakes = Contains($feature,FeatureSetByName($map,"Lake Report 2021"))
var lakes_list = []
for (var f in lakes){
Push(lakes_list, f.OFFICIAL_N)
}
return Concatenate(lakes_list, '\n')
Hello, I was able to do an intersect of the layers using Arcade and I am able to see the expression value in my pop-up. Is there a way to take this expression into a dashboard? I am just trying to show the value in a list. Thank you.