Skip to main content
deleted 8 characters in body
Source Link
Bera
  • 77.8k
  • 14
  • 78
  • 188

I Think youYou 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

enter image description here

I Think 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

enter image description here

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

enter image description here

deleted 11 characters in body
Source Link
Bera
  • 77.8k
  • 14
  • 78
  • 188

I Think 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 (I Think..) 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

enter image description here

I Think 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 (I Think..)

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

enter image description here

I Think 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

enter image description here

added 94 characters in body
Source Link
Bera
  • 77.8k
  • 14
  • 78
  • 188

I Think 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 (I Think..)

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

Some if statements at the end might solve your problem. Or use modulus to get two symbols, one for even numbers and one for odd.

enter image description hereenter image description here

I Think you can use Arcade to create an expression.

I dont really know what im doing. Just pasted the code from: VxCount = !shape!.pointcount fuction in AGOL.

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))

Some if statements at the end might solve your problem. Or use modulus to get two symbols, one for even numbers and one for odd.

enter image description here

I Think 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 (I Think..)

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

enter image description here

Source Link
Bera
  • 77.8k
  • 14
  • 78
  • 188
Loading