1

I have two layers. One point layer and one polygon layer.

The point layer has several points that fall within each polygon. The points represent different types of sports, and the polygons represent the buildings that house these sports.

I want to be able to click on a building, and have a pop-up which lists all the available sports within that building. I am using Arcade expressions in the pop-up, but am stuck on only being able to list one of the sports on the pop-up using this tip:

https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2018/12/10/overlapping-features-in-pop-ups-quick-introduction-to-using-featuresets-with-arcade

Is there a way to list all of the sports that intersect?

1 Answer 1

0

So the points contain the Sports and the polygon contain the building.

The best way to do this would be to use the "Custom Pop-up" and arcade functions within ArcGIS Online.

Head to the "Configure Pop-up" dialog and under "Attribute Expressions" hit the "ADD" button.

Here in the expression window, you can add the follwoing expression:

var points =FeatureSetByName($map,"Sport_Sites");
var countp = Intersects(points,$feature);

var result = "";
for (var item in countp){
    var id = item["sports"];
    result += id + ' '
}
return result

I have assumed the point layer is "Sports_Sites", but you can have the expression builder choose the correct layer for you, by heading to the "Functions" and typing in FeatureSetByName, and selecting the correct layer from the list shown.

Basically this expression takes the point layer and intersects it with the polygon layer, creating a "list" of intersecting features "countp". The expression with then "For each item in the intersections" create a string of results for each polygon.

When you save this, and then select a building in the map you will be provided with the regular pop-up, but an additional field (at the bottom of the pop-up window) containing a list of all sports that intersect with that polygon - "cricket basketball swimming".

To "Prettify" the result, you ight want to head back to the "Configure Pop-up" window and change the "Pop-up contents" to Display "Custom attribute display" and then Configure.

The configure window gives you a lot of control in terms of how the pop-up displays. You could hit the "html source" button to configure these data into a table. i like to use a HTML Table Generator to crete the source code, and then add the attributes.

Example of HTML Generator

Next to the "Size" drop-down, there is a "+", this lets you insert the attributes from the feature layer, there will be a "Custom" field. This is the result from your Arcade expression.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.