Select to view content in your preferred language

ArcGIS Online Arcade Intersection/Contains Function Not Recognizing Each Point

188
1
07-15-2025 08:28 AM
Labels (1)
chaehl
by
New Contributor

Hello, 

I am looking for help with arcade expressions. I'm attempting to use arcade to pull and summarize data from other layers that overlap a parcel. I'm using FeatureSet and Intersects or Contains functions to do so. Unfortunately, I'm noticing some inconsistencies and I'm not sure if its the arcade expression or something else. The issue is that the expression works for most instances but appears to randomly fail for others. I've attached screenshots below as well as the arcade expression itself. Any help with resolving this issue and ensuring all points are identified correctly is appreciated. Thank you!

Screenshot of the expression working as intended. The green point represents 'Closed Activity' which is picked up by the arcade expression and correctly displayed by the Activity ID in the Parcel's pop up.Screenshot of the expression working as intended. The green point represents 'Closed Activity' which is picked up by the arcade expression and correctly displayed by the Activity ID in the Parcel's pop up.Same expression, different parcel. A buffer is included in the expression yet the expression still fails to recognize the point and populate the pop-up.Same expression, different parcel. A buffer is included in the expression yet the expression still fails to recognize the point and populate the pop-up.

 

var brrts_fs = FeatureSetByName($map, "Closed Activity")
var brrts = Contains(Buffer($feature, 5), brrts_fs)
var brrts_count = Count(brrts)
var b_array = []

if(brrts_count == 0){
  return { 
	type : 'text', 
	text : `<font color = "#19234A"><b>IS THERE CLOSED ACTIVITY?</b></font>` + '<br>' + `NO`
}
} 
else {
  for (var b in brrts){
	Push(b_array, b['ACTIVITY_DETAIL_NO'])
  }

  var unique_b = Distinct(Sort(b_array))
  var con_b = Concatenate(unique_b, ', ')
  var arr = Split(con_b, ", ")
  var output = []

  for (var index in arr) {
    var code = arr[index]
    var pub = Filter(brrts_fs, "ACTIVITY_DETAIL_NO = @code")
    var item  = `<a href="https://apps.dnr.wi.gov/rrbotw/botw-activity-detail?crumb=2&siteId=29104100&dsn=${First(pub).DETAIL_SEQ_NO}">${code}</a>`
    Push(output, item)
  }
  return { 
	type : 'text',
	text : `<font color = "#19234A"><b>IS THERE CLOSED ACTIVITY?</b></font>` + '<br>' + `${Concatenate(output, " | ")}`
  }
}

 

0 Kudos
1 Reply
ChristopherCounsell
MVP Frequent Contributor

The second one is failing because the point is 'on' the boundary line. Contains needs to have the point entirely within the polygon. Intersect would pick it up if it's on the boundary line.

As it being on the line or not, using $feature will also use the view scale resolution of the map. That's why you're getting different results and why the point is getting considered to not be within.

https://developers.arcgis.com/arcade/function-reference/geometry_functions/#contains

0 Kudos