Arcade Expression testing intersect on more than one layer...

3230
2
Jump to solution
10-14-2021 07:18 AM
AndrewIngall1
Occasional Contributor

Hello

I have created a Arcade expression to look if a point intersects a polygon and return the name of the polygon within the pop up if if finds anything, if not it will return private land.

The code is below.

var fs = FeatureSetByName($map,"United Kingdom LSOA Boundaries 2019")
var int = First(Intersects($feature, fs))

If (int == Null) {
return "Private Land"
} else {
return Proper(int.NAME, 'everyword')
}

 

The question is how can i check other polygon layers at the same time to find the name of the polygon?  I am thinking along the lines of IF ELSE THEN

So test the first polygon, if the point is within that return the name, if not test the second polygon layer and if the point is intersecting with that, then return the name.  If there is no intersection then return Private Land...

 

Thanks for any help.

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

You can do this easily enough with if... else if... else.

// Get other layers from map
var fs1 = FeatureSetByName($map, "United Kingdom LSOA Boundaries 2019", ['NAME'], true)
var fs2 = FeatureSetByName($map, "Some Other Layer", ['NAME'], true)

// Get intersections
var int1 = First(Intersects($feature, fs1))
var int2 = First(Intersects($feature, fs2))

// Check first intersection
if(!IsEmpty(int1)) {
    return Proper(int1.NAME, 'everyword')
// Check second intersection
} else if(!IsEmpty(int2)) {
    return Proper(int2.NAME, 'everyword')
} else {
    return "Private Land"
}

 

Are there situations in which there might be an intersection from both layers, though?

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

You can do this easily enough with if... else if... else.

// Get other layers from map
var fs1 = FeatureSetByName($map, "United Kingdom LSOA Boundaries 2019", ['NAME'], true)
var fs2 = FeatureSetByName($map, "Some Other Layer", ['NAME'], true)

// Get intersections
var int1 = First(Intersects($feature, fs1))
var int2 = First(Intersects($feature, fs2))

// Check first intersection
if(!IsEmpty(int1)) {
    return Proper(int1.NAME, 'everyword')
// Check second intersection
} else if(!IsEmpty(int2)) {
    return Proper(int2.NAME, 'everyword')
} else {
    return "Private Land"
}

 

Are there situations in which there might be an intersection from both layers, though?

- Josh Carlson
Kendall County GIS
AndrewIngall1
Occasional Contributor

Thanks so much Josh.  That's ideal.  There will be no occasions where the point is in both datasets.