Select to view content in your preferred language

Arcade Vertices Count for Polygons with Curves

48
0
yesterday
Labels (3)
cquick2
New Member

I have an arcade question. Essentially, I want each of my land parcels to have the number of vertices labeled on them. It works for the vast majority of parcels, but not those with curves. This is easily reproduceable by creating a basic polygon and one with curves. This is the expression I am using:

 

 

var geom = Geometry($feature);
if(TypeOf(geom) == "Polygon") {
   var numVertex = Count(geom.rings[0]);
return numVertex-1;
}

 

 

 

cquick2_0-1721941170952.png

With the polygon on the right, it is clear that there are 8 vertices and the expression returns the correct result. On the left parcel, there are 7 vertices, but the expression returns 46. My guess is that the additional vertices do exist and are used to draw smooth curves, but are usually hidden from the user. I need an expression that returns the correct number of vertices (i.e. the count matches the number of vertices identified using the Feature Vertices to Points tool*) even on parcels with curves. Obviously this would be easier if Arcade had a vertex count function but it doesn't appear to.

* it also would match the !GEOM!.pointcount expression in Python

0 Kudos
0 Replies