I think this was possible using the screening tool in Web App Builder, but I need to do the following in Experience Builder. I am trying to use widgets to do the following, but can't seem to get the results to wokr.
a) use search widget to locate a wildfire polygon perimeter in a map and zoom or pan to it, then
b) use Near me to calculate acres of multiple features in another feature service (surface management agency) that intersect the wildfire boundary identified in the Search widget (or that I select in the map, I am not picky, but that selected polygon will change with each use of these tools
c) provide calculated acres by management agency that intersects the selected wildfire polygon so these acres can be viewed.
So, taking features from dataset A (surface management agency) intersecting a selected feature in dataset B (wildfire polygon), calculating acres for the multiple polygons identified in the intersect and displaying the list of acres in a text widget. Any help would be appreciated.
Solved! Go to Solution.
@AustinAverill was able to quickly help me out. Here is the arcade script to calculate instersected layers in the pop-up:
//assigning the agency layer to a variable using the name in the map var agencies = FeatureSetByName($map, "BLM AZ SMA - BLM AZ Surface Management Agency (Polygon)") //get all agency polygons that intersect our event polygon var intersectingAgencies = Intersects($feature, agencies) //get distinct agencies var distinctAgencies = Distinct(intersectingAgencies, "ADMIN_AGENCY_CODE") //define the variables to store our generated information in var fldinfos = [] //will contain the field information to create a table element var atts = {}//will contain the attribut we want to display //loops through distinctAgencies and get intersecting area for(var a in distinctAgencies){ var nm = a['ADMIN_AGENCY_CODE'] //filter intersecting features down to current agency var nmFeatures = Filter(intersectingAgencies, `ADMIN_AGENCY_CODE = '${nm}'`) //define placeholder to sum multiple intersecting features of same agency var acres = 0 for(var row in nmFeatures){ //defines the intersection of area between current feature and intersecting features, and calculates area in acres var calcAcres = AreaGeodetic(Intersection(Geometry($feature), Geometry(row)), 'acres') acres += calcAcres } //store the calculated overlaps into out placeholders from before Push(fldinfos, {fieldName : nm}) atts[nm] = `${Round(acres, 1)} Acres` } //define the field list element we will return var element = { type: 'fields', //title: '', //description : '', fieldInfos: fldinfos, attributes : atts // replace this dictionary with your own key-value pairs } return element
This looks like a job for the Analysis Widget. Specifically the Overlay Layers Tool. Note: using the Analysis Widget in ArcGIS Online costs Credits.
https://developers.arcgis.com/experience-builder/guide/analysis-widget/
The available run time tools in ExB Online are not going to be able to very easily handle this sort of task (if you can get it to appropriately segment the area by agency at all). This would be a much more effective component of the wildfire polygons pop-up. You could populate the values by agency using a Arcade relatively easily and be much simpler for the end user to interact with (just click the wildfire).
Thanks for your feedback. I think this calculation into a wildfire polygon attribute would need to be run rather frequently. The wildfire polygon is a nationwide live hfs, changing sometimes multiple times daily, edited by many users, managed by a few, and not owned by me.
Didn't the screening tool do this in Web App Builder (just want to confirm as I have only heard this, not used it when it was available and functioned in this workflow). I understand of course that the screening tool has not been updated yet in ExB.
Again, I appreciate your help with this.
The screening tool did used to do something similar to this. The near me tool still allows you to get similar results, and there is an option to output the sum of intersected area. But the sum of intersected area would be by layer, not by category/attribute of a single polygon layer.
In terms of arcade, you can write an arcade script to display in the popup that recalculates this on the fly. This means it's only calculated whenever a user interacts with the popup, does not need to be stored anywhere, and updates as soon as your data updates. I still contend this would be the best way to solve and display this data quickly and efficently for your end users.
I agree with @AustinAverill. Arcade would be a good solution assuming the answer does not need to be saved. Also, the Arcade solution would not cost Credits.
Not using credit's is Arcade's biggest advantage over everything! If you want to share the way your layers and fields are layed out, I'd be happy to help write the script if you don't have experience with it @DanaLRobinson
direct msg sent to you.
@AustinAverill was able to quickly help me out. Here is the arcade script to calculate instersected layers in the pop-up:
//assigning the agency layer to a variable using the name in the map var agencies = FeatureSetByName($map, "BLM AZ SMA - BLM AZ Surface Management Agency (Polygon)") //get all agency polygons that intersect our event polygon var intersectingAgencies = Intersects($feature, agencies) //get distinct agencies var distinctAgencies = Distinct(intersectingAgencies, "ADMIN_AGENCY_CODE") //define the variables to store our generated information in var fldinfos = [] //will contain the field information to create a table element var atts = {}//will contain the attribut we want to display //loops through distinctAgencies and get intersecting area for(var a in distinctAgencies){ var nm = a['ADMIN_AGENCY_CODE'] //filter intersecting features down to current agency var nmFeatures = Filter(intersectingAgencies, `ADMIN_AGENCY_CODE = '${nm}'`) //define placeholder to sum multiple intersecting features of same agency var acres = 0 for(var row in nmFeatures){ //defines the intersection of area between current feature and intersecting features, and calculates area in acres var calcAcres = AreaGeodetic(Intersection(Geometry($feature), Geometry(row)), 'acres') acres += calcAcres } //store the calculated overlaps into out placeholders from before Push(fldinfos, {fieldName : nm}) atts[nm] = `${Round(acres, 1)} Acres` } //define the field list element we will return var element = { type: 'fields', //title: '', //description : '', fieldInfos: fldinfos, attributes : atts // replace this dictionary with your own key-value pairs } return element