Arcade docs: Working with vertices

721
1
03-08-2022 11:08 PM
Status: Open
Labels (1)
Bud
by
Notable Contributor


Could Esri add a section to the docs that explains how to work with vertices in Arcade?

For example, to loop through polyline vertices and read them, do the following:

var geo = Geometry($feature);
for (var part in geo.paths) {
    var line_part = geo.paths[part]
for (var i in line_part) {

 
To loop through polyline vertices and modify them, do the following:

var geo =  Dictionary(Text(Geometry($feature)));
var paths = geo['paths'];
for (var path_idx in paths){
    for (var vert_idx in paths[path_idx]){

Explanation:
Geometries are immutable, so we can't modify them directly. But if we convert them to a dictionary, then we can modify the entries in the dictionary, and then use that dictionary to create a new geometry.

 

As far as I know, there isn't anything in the docs that explains how to work with individual vertices by looping through geometries. Sure, there are samples in the GitHub repo, and they're definitely useful. But it seems like a thorough explanation in the docs would be a big help to people who are learning this stuff from scratch. 


Related post: Arcade: Get paths array from feature

 

 

1 Comment
Bud
by

Has there been any movement on this? It seems like it's necessary and should be under consideration.