Hello,
I needed to build a small application using Experience Builder to allow my users to search for a plot by number and check if it was located in a special zoning area for building permits. I had difficulty finding a simple and effective solution, so I am sharing it with you today.
My constraints:
- The layer containing the plots could not be modified, so I couldn't add a spatial join field from ArcGIS Pro before publishing on ArcGIS Online.
- The application was intended for the general public, so the usage had to be as simple as possible.
- I wanted to minimize the number of clicks for the user, so no multiple queries.
My solution:
- A Web Map containing my "plots" and "areas" layers.
- An Experience Builder application with a query widget allowing the user to enter their plot reference (in 2 fields).
- The use of an expression in the pop-up window to check the geometric intersection between the two layers.
- The use of a "text" type content for displaying the result of the expression in the pop-up window.
(Thank you to Kelly Gerrow : https://community.esri.com/t5/arcgis-online-blog/overlapping-features-in-pop-ups-quick-introduction/...)
- Enabling the "Show pop-up upon feature selection" map option in Experience Builder.
Here is the code for the expression used in the pop-up window of my "plots" layer:
var intersectLayer = Intersects(FeatureSetByName($map, "Zones"), Buffer($feature, -1, 'meter'))
var Res = "The plot is not in the zone"
for (var f in intersectLayer){
var Res = "The plot is in " + f.TYPE
}
return Res
Here is the result (in french sorry) :
I hope this can inspire other ESRI users.