Discover coincident polygons in popup with arcade

325
2
12-26-2023 03:23 PM
Labels (1)
StaceyRoberts
New Contributor II

All -  the goal is to click on a project area ploygon and show in the popup the coincident council district and env justice polygon info in the popup. The project layers are portal feature services. The council districts and env justice map services from other portals. All of these are layers in a web map that part of a web app builder project. 

We configure the popups in the the Pro project to retain custom popup settings because we do have the need to republish the services which wipes out web map popups so I have been able to accomplish this scenario in ArcGIS Pro using the FeatureSetByName.$map option with all data in the same pro project (which was a feat since I'm not a programmer and newbie to arcade). However, this will not translate into the web app.  

If I went to the trouble to rebuild the popups in the web map, is this something I can do... intersect 3 layers to show fields from overlaying layers in a popup? 

<sample here with one intersect in Pro>

var districts = FeatureSetByName($map, "Council Districts", ['DISTRICT'], true);
var projects = featuresetbyname ($map, "Projects by Fiscal Year");
var allDistricts = Intersects(districts, $feature);
var result = " ";
for (var item in allDistricts){
var id=item["DISTRICT"];
result += id + ' '
}
return result

The user clicks on a project polygon who's geometry intersects council districts 1, 2, 3 so the popup is configured to display

"Project is in council distrct(s) 1 2 3"

Thanks for any advice!

0 Kudos
2 Replies
rwrenner_esri
Esri Contributor

This method should also be possible in the web map using Intersects(). Another example is outlined in the following blog post - see section Spatially-Related Data:

https://www.esri.com/arcgis-blog/products/arcgis-online/data-management/pump-up-your-pop-ups-with-ar...

-Rylee

0 Kudos
StaceyRoberts
New Contributor II

That all looks very promising. Thanks for sharing the blog post!

0 Kudos