Display a pop-up of points that are within a polygon.

506
5
Jump to solution
07-10-2020 02:42 PM
BenWan
by
New Contributor III

Hi,

I am trying to figure out a way where you can take information from a point layer, and have it appear in a pop-up of a polygon layer.

For example, I have a property that consists of a building, a basketball court, two tennis courts, and a soccer field. I want to be able to click the polygon and have the pop-up tell me that I have those point features within the polygon.

Can this be easily done via expressions when you configure the pop-up? If this can be done solely on AGOL that would be great, but I have access to Pro as well.

Thanks!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
KellieH
New Contributor II

I'll give an example of one of the fields in my current project that I am doing this with. This should return a list of all features from the intersect layer (with the field you specify) that intersect with your polygon layer.

var intersectLayer =Intersects(FeatureSetByName($map,"Layer you want results for"), $feature)
var results = [];
for (var f in intersectLayer){
 results[Count(results)] = f.FIELDYOUWANT;
}

return Concatenate(results, ", ");

View solution in original post

0 Kudos
5 Replies
KellieH
New Contributor II

This can be done with arcade expressions. 

This page should be helpful https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2018/12/10/overlapping-features-i... 

0 Kudos
BenWan
by
New Contributor III

Hi Kellie,

This worked, and was straight forward!

So I was able to return one of the values, but the relationship is one to many, for example I was only able to return 1 of the sports, is there a way for it to return every single sport, each in its own line item?

Thanks again!

0 Kudos
KellieH
New Contributor II

I'll give an example of one of the fields in my current project that I am doing this with. This should return a list of all features from the intersect layer (with the field you specify) that intersect with your polygon layer.

var intersectLayer =Intersects(FeatureSetByName($map,"Layer you want results for"), $feature)
var results = [];
for (var f in intersectLayer){
 results[Count(results)] = f.FIELDYOUWANT;
}

return Concatenate(results, ", ");

View solution in original post

0 Kudos
BenWan
by
New Contributor III

This is amazing, you are amazing. Thank you so much!

0 Kudos
BenWan
by
New Contributor III

I actually have another, just random, question. Just popped up in my head and thought it might be cool.

Is there a way to list the features out, and if there are multiple that are the same, list it and have a count next to it?

For example listing them out like this:

Feature A (5)

Feature B (2)

Feature C (4)

Feature D (1)

0 Kudos