Hi Miguel Angel Barrientos Martinez ,
You mention that this expression will calculate the vertices of a feature class, but I assume you are mean a feature, since that is what the python expression will do.
In Arcade you can determine the number of vertices, but the expression will probably be different depending the type of geometry you have. On what type of geometry do you want to apply the Arcade expression?
Have a look at the following function:
Function CountVertices(geom) {
var cnt_vertices = Null;
var geom_type = TypeOf(geom);
Console(geom_type);
if (geom_type == "Point") {
cnt_vertices = 1;
} else if (geom_type == "Multipoint") {
cnt_vertices = Count(geom.points);
} else if (geom_type == "Polyline") {
var cnt_line = 0;
for (var i = 0; i < Count(geom.paths); i++) {
cnt_line += Count(geom.paths[i]);
}
cnt_vertices = cnt_line;
} else if (geom_type == "Polygon") {
var cnt_pol = 0;
for (var i = 0; i < Count(geom.rings); i++) {
cnt_pol += Count(geom.rings[i]);
}
cnt_vertices = cnt_pol;
} else {
}
return cnt_vertices;
}
var pt = Point({ 'x': 100, 'y': 100, 'spatialReference':{'wkid':102100} });
var line = Polyline({ 'paths' : [ [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ], [ [-97.06326,32.759], [-97.06298,32.755] ] ] , 'spatialReference':{'wkid':102100}});
var poly = Polygon(Polygon({'rings' : [ [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ], [ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ] ], 'spatialReference':{'wkid':102100}}));
var mp = Multipoint({ 'points' : [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ], 'spatialReference':{'wkid':102100} });
Console(CountVertices(pt));
Console(CountVertices(mp));
Console(CountVertices(line));
Console(CountVertices(poly));
return "OK";
This will print the following information to the Console with the provided test geometries:
Point
1
Multipoint
4
Polyline
6
Polygon
9