I am using ArcGIS Pro.
Is it possible to change polygon colour after i change it's geometry?
For example, if there were five vertices, the figure is green, and after i change it to be four vertices I want it to become black.
You can use Arcade to create an expression.
I dont really know what im doing (first time using Arcade). Just pasted the code from: VxCount = !shape!.pointcount fuction in AGOL and modified last line to output 0 for even number of vertices and 1 for odd. You can of course change this to output whatever value you want with some if/else:
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 {
// this should not happen...
}
return cnt_vertices;
}
return (CountVertices(Geometry($feature))-1)%2
I think that this could be semi-automated by using Attribute-driven color in symbology:
You can customize feature symbols by leveraging data attributes as symbol property values.
I would start by adding a field that gets populated with the number of vertices, then I would add another field to store color values and set those colors based on the number of vertices.
To become fully automated you could try combining attribute driven symbology with Calculation attribute rules:
Calculation rules are used to automatically populate attribute configurations on a feature. They can be created as immediate calculation rules ...
- Immediate calculation rules—Rule evaluation occurs immediately during edit operations. The type of triggering event specified during rule creation allows rule evaluation to occur based on insert, update, or delete operations.
I have used attribute driven symbology successfully for other purposes, but I have not tried calculation attribute rules.