HOW TO
Features overlap one another to demonstrate the spatial relationship between sublayers on a map, as shown in the image below. At times, it is necessary to determine the area of the intersection. This task can be completed using an Arcade expression in Portal for ArcGIS and ArcGIS Online Map Viewer. This article provides a workflow to calculate the intersected area of two polygon sublayers from a hosted feature layer in the web map using an Arcade expression.
Note: For ArcGIS Online, in the Pop-ups pane, click Attribute expressions > Add expression.
var blocks = Intersects(FeatureSetByName($datastore, "<polygon_Layer2>"), $feature); var cnt = Count(blocks); var intersectArea = 0;
if (cnt > 0) { for (var block in blocks) { intersectArea += Area(Intersection($feature, block), "<unit of measurement>"); } } return Round(intersectArea, 2);
The following code block demonstrates the full Arcade expression.
var blocks = Intersects(FeatureSetByName($datastore, "Polygon2"), $feature); var cnt = Count(blocks); var intersectArea = 0; if (cnt > 0) { for (var block in blocks) { intersectArea += Area(Intersection($feature, block), "meter"); } } return Round(IntersectArea, 2);
Note: For ArcGIS Online, after copying and pasting the Arcade expression in the expression box, click Run.
Note: For ArcGIS Online, when the Output tab displays the distance, click Done.
The image below shows the intersected area of the two polygons is 5643.11 meters.
Get help from ArcGIS experts
Download the Esri Support App