HOW TO

Determine polygon complexities using Arcade in ArcGIS Enterprise portal and ArcGIS Online

Last Published: January 14, 2025

Summary

Assessing polygon complexities is crucial for performance optimization in the ArcGIS Enterprise portal and ArcGIS Online. High vertex density in polygons affects map rendering and analytical processes. By identifying complex polygons, geometry can be simplified and analytical workflows adjusted to enhance efficiency.

This article describes the workflow to determine the polygon complexities in the ArcGIS Enterprise portal and ArcGIS Online using Arcade.

Procedure

  1. Log in to the ArcGIS Enterprise portal or ArcGIS Online and click Content > My Content.
  2. Click the hosted feature layer to open the item page.
  3. Add a new field. Refer to Portal for ArcGIS: Add a field or ArcGIS Online: Add a field for instructions. In this example, a new field, ‘Description’, is added to the attribute table.
  4. Open the Arcade window. Refer to Portal for ArcGIS: Calculate values for a field from the item page or ArcGIS Online: Calculate values for a field from the item page for instructions.
  5. In the Expression box, specify the following Arcade expression.
    1. To obtain the geometry of the current polygon:
var polyFeat = $feature;
  1. To calculate the area of the polygon:
var featArea = Area(polyFeat);
  1. To calculate the length of the polygon's perimeter:
var perimeter = Length(polyFeat);
  1. To calculate the expected perimeter for a circle with the same area; this value is used as a reference to calculate the complexity of a polygon.
var expectedPerimeter = 2 * 3.1416 * Sqrt(featArea / 3.1416);
  1. To calculate the shape complexity:
var complexity = perimeter / expectedPerimeter;
  1. To categorize the complexity into string values:
var complexityCategory = "";

if (complexity < 1.1) {
    complexityCategory = "Compact"; // More regular shape, close to a circle
} else if (complexity >= 1.1 && complexity <= 1.3) {
    complexityCategory = "Moderately Complex"; // Slightly irregular shape
} else {
    complexityCategory = "Highly Irregular"; // Very complex shape with a higher perimeter
}
  1. To return the shape complexity in string values:
return complexityCategory;

The code block below shows the example of the full working script:

var polyFeat = $feature;

var featArea = Area(polyFeat);

var perimeter = Length(polyFeat);

var expectedPerimeter = 2 * 3.1416 * Sqrt(area / 3.1416);

var complexity = perimeter / expectedPerimeter;

var complexityCategory = "";

if (complexity < 1.1) {
    complexityCategory = "Compact"; // More regular shape, close to a circle
} else if (complexity >= 1.1 && complexity <= 1.3) {
    complexityCategory = "Moderately Complex"; // Slightly irregular shape
} else {
    complexityCategory = "Highly Irregular"; // Very complex shape with a higher perimeter
}

return complexityCategory;
  1. Click OK.

The polygon complexity categories are added to the Description field in the attribute table as shown below.

The polygon shape complexity in the attribute table

Article ID: 000034220

Software:
  • ArcGIS Online
  • Portal for ArcGIS
  • ArcGIS Enterprise 11 3
  • ArcGIS Enterprise 11 2
  • ArcGIS Enterprise 11 4

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options