Select to view content in your preferred language

Arcade Centroid function sometimes places point outside of polygon

8234
10
Jump to solution
03-19-2021 12:23 PM
Labels (2)
TomMiller
Emerging Contributor

I am using the arcade expression builder in enterprise 10.8.1 web map. I am trying to select the intersection of two polygons, using the centroid of one. However, the arcade function "Centroid" does not give me a parameter to specify that I only want the point placed inside the poly, so it is giving me false results. Here is my code so far:

var citylimits = FeatureSetByName($map,"City Limits")

var inter = intersects(centroid($feature) ,citylimits)

var cityname = ''

for (var i in inter){
cityname = i.CITY + ' City Limits'
}

if(cityname == ''){
cityname = ' '}

return cityname

Since the point is sometimes placed outside of the polygon, my result gives me false returns. Any tips here on using centroid in arcade?

Tags (2)
0 Kudos
10 Replies
MattReeves_SpokaneValley
Frequent Contributor

I want a Label in a print layout to update based on the centroid of the maps intersection with a particular layer. Is that doable?

 

Matt Reeves
0 Kudos