HOW TO
In the ArcGIS Enterprise portal and ArcGIS Online, polygon features can be ranked based on the density of field values within each polygon. This is calculated by dividing the value of a specified field in a polygon by the polygon's area. An ArcGIS Arcade script can be used to compare the density of field values across all polygons in a layer and assign a rank to each polygon based on this comparison. This is ideal for visualization analysis, as creating a rank-based visualization allows for quick identification of areas with significant concentrations of points. This can aid in decision-making processes by highlighting areas that need attention or further investigation.
This article describes the workflow to rank polygons by density using an Arcade expression in Portal for ArcGIS and ArcGIS Online.
var rankExpression = $feature["<fieldName>"] / $feature["SHAPE__Area"];
var allFeatures = FeatureSetByName($datastore, "<polygonName>");
var currentRank = 1; var currentFeatureRank = 1;
for (var feature in allFeatures) { if (feature == $feature) { continue; } var featureRank = feature["<fieldName>"] / feature["SHAPE__Area"]; if (featureRank > rankExpression) { currentRank++; } }
return currentRank;
The code block below shows the example of the full working script.
var rankExpression = $feature["numberofpoints"] / $feature["SHAPE__Area"]; var allFeatures = FeatureSetByName($datastore, "Polygon"); var currentRank = 1; var currentFeatureRank = 1; for (var feature in allFeatures) { if (feature == $feature) { continue; } var featureRank = feature["numberofpoints"] / feature["SHAPE__Area"]; if (featureRank > rankExpression) { currentRank++; } } return currentRank;
The image below shows the polygons are ranked based on the density of the field values in the attribute table. The rank of each polygon is determined by counting the higher ratio. The more features with a higher ratio, the lower the number value in the Rank field.
Article ID: 000033017
Get help from ArcGIS experts
Download the Esri Support App