Why is my Arcade Intersects Expression not returning consistently correct results?

168
1
01-07-2021 09:45 AM
Labels (2)
AlaskaDepartment
New Contributor

I've written an Arcade Pop-Up expression that uses the Intersects function to return "Intersecting" or "Not Intersecting" based on whether a point feature intersects a polygon feature. I am getting varied results, with multiple cases of the Pop-Up returning "Not Intersecting" when the point is clearly intersecting a polygon feature. In my attached photo, the salmon colored area is a polygon, the white color is outside the bounds of the polygon.

Pop-up expression:

```
var geom1 = $feature;
var geom2 = FeatureSetByName($map,"Groundwater Plumes");
var intersectLayer = Intersects($feature, geom2);
var cnt = Count(intersectLayer)
var plume_int = " "

 

if (cnt >= 1) {
    for (var f in intersectLayer){
        plume_int = "Intersecting"
    }
} else {
    plume_int = "Not Intersecting"
}
return plume_int;
```
[![example of intersect error][1]][1]


[1]: https://i.stack.imgur.com/UxTvR.png

1 Reply
XanderBakker
Esri Esteemed Contributor

Hi @AlaskaDepartment ,

 

I think the problem is in the intersects function. You need to specify the plumes featureset as first parameter and the current feature as second parameter. Try this:

 

var poi = $feature;
var plumes = FeatureSetByName($map, "Groundwater Plumes");
var intersectLayer = Intersects(plumes, poi);

var cnt = Count(intersectLayer);
var plume_int = "";
if (cnt >= 1) {
    plume_int = "Intersecting";
} else {
    plume_int = "Not Intersecting";
}

return plume_int;