HOW TO
In spatial analysis, understanding the geometry of polygons is crucial for accurate data interpretation and decision-making. Calculating the number of vertices in a polygon is a fundamental task that enhances the precision of geographic analyses. When creating a freehand polygon, the number of vertices can far exceed that of a standard polygon. This is due to the continuous and detailed nature of freehand drawing, which captures every subtle curve and movement as a vertex. This can also be useful in determining whether polygons are standard or freehand.
This article provides the workflow to calculate polygon vertices in the ArcGIS Enterprise portal and ArcGIS Online.
var geometry = Geometry($feature);
var rings = geometry.rings;
var vertexCount = 0;
for (var i in rings) { vertexCount += Count(rings[i]); }
return vertexCount;
The code block below shows an example of the full working script.
var geometry = Geometry($feature); var rings = geometry.rings; var vertexCount = 0; for (var i in rings) { vertexCount += Count(rings[i]); } return vertexCount;
The image below shows the count of vertices of each polygon generated in the attribute table.
Get help from ArcGIS experts
Download the Esri Support App