In an AGOL webmap, I have an Attribute Expression (that I sourced from here😞
Â
// get the states layer
var portal = Portal('https://arcgis.com')
var states = FeatureSetByPortalItem(
portal,
'a454cf97c4264cd2b77f27175e01d3ba',
3,
['ABBRV']
)
// intersect feature with States
var xs = Intersects(
$feature,
states
)
// create array of intersected state names
var c_array = []
for (var c in xs){
Push(c_array, c['ABBRV'])
}
// remove duplicates
var unique_states = Distinct(c_array)
// concatenate array, return string
return Concatenate(unique_states, ', ')That works as expected: user clicks on a line, pop-up returns a list of state(s) that the selected line intersects.Â
Here's the problem: the line is multiple parts (features? Sections?). CHunked up by numerous attributes (state, county, district, etc....). So if the user clicks on a line segment, they get the state(s) that the segment intersects.Â
But what I want is:Â
Every single state the ENTIRE line intersects, based on the name of the line. So if the NAME attribute of the line they click on is "BIGFOOT", some sort of magical arcade thing that FIRST selects every single line segment (which could be dozens) with NAME = "BIGFOOT", then do the intersect and return every state intersected by every line segment where NAME = "BIGFOOT".