With the December update of ArcGIS Online, the ability to reference other layers using Arcade Expressions in Pop-Ups was introduced. This blog is going to outline a quick example about how to create a simple intersect expression and display the results in a Pop-Up.
In this example I have used 4 layers marked as authoritative in ArcGIS Online by Miami-Dade County, Florida. I want to display the Elementary, Middle and High School names which intersect with building footprints in a single pop-up. I have three layers of School Attendance Boundaries which identifies a specific school boundary which overlaps with many building footprints. The building footprint layer contains geometry information but no information about the infrastructure or zones that intersect with the building.
This Web Map shows examples of the information available in these layers in 4 separate layers.
Using the new Arcade FeatureSet functionality, I was able to include the Elementary, Middle and High School names in the building footprint pop up in this web map.
Here are the steps to set up this simple intersecting Arcade Expressions to include in a pop-up.
Add all the desired layers with information that you would like to see to a web map.
Select the layer that should display the pop-up information (Building Footprint)
Inspect the School Attendance Boundary layers to identify the fields that you would like to display in the Building Footprint layer Name)
Select Configure Pop up and navigate to the Add Attribute Expressions
Create the expression for each layer.
Create a variable that returns the FeatureSet of intersecting feature attributes.
var intersectLayer =Intersects(FeatureSetByName($map,"Elementary School Attendance Boundary"), $feature)
Expression Values Explained:
var intersectLayer – specifies the intersecting features variable name
Intersects – specifies the geometry function one feature intersects the geometry of the other specified layer.
FeatureSetByName – Creates a FeatureSet from a Feature Layer based on its name within a map or feature service
$map,"Elementary School Attendance Boundary"– identifies that the feature set is a layer named Elementary School Attendance Boundary, within the web map.
$featureis the feature that is being selected in the Building Footprint layer that provides the initial spatial information.
b. Loop through the feature set created and return a specific field from the feature set:
for (var f in intersectLayer){
return f.NAME
}
6. Once all expressions are created, add them to the pop up configuration.
7. Disable the pop ups and potentially the visibility from the School Attendance Boundary Layers (Not required, but I think it cleans up the display,
8.Check out your pop up with information from intersecting layers.
There will be more documentation, blogs and examples coming out in the next week, but try out this quick sample with simple intersecting layers and let us know if you have questions.
Entire expression for a single high school name:
var intersectLayer =Intersects(FeatureSetByName($map,"Elementary School Attendance Boundary"), $feature)
for (var f in intersectLayer){
return f.NAME
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.