Select to view content in your preferred language

Dynamic vertex number labels

1233
6
06-08-2022 07:37 PM
Labels (1)
Bud
by
Esteemed Contributor

Is there an easy way to dynamically label a feature's vertex numbers in ArcGIS Pro?

It would look like this:

Bud_0-1654741965434.png

Ideally, it would use the zero-based numbering system — to be consistent with the vertex numbers in the Sketch window.

Thanks.

6 Replies
JohannesLindner
MVP Frequent Contributor

Doesn't seem that way.

The label engine can only label the whole polygon. 

I thought I had something with symbology, but I only managed to get the vertex count to be displayed on each vertex. Sequential numbering isn't possible, because Arcade expressions aren't evaluated for each vertex, but for the whole feature.

JohannesLindner_0-1654760758974.png

 

If you really need this feature, you'll have to extract the vertices to points and label those. To make it dynamic, you could create an Attribute Rule that creates and deletes those points when you edit the polygon geometry. Depending on your average vertex count, this might have a low to medium impact on edit performance.


Have a great day!
Johannes
Robert_LeClair
Esri Notable Contributor

Johannes is correct that there is no way to do this in the label engine.  The Feature Vertices to Points (Data Management) GP tool (requires an Advanced license) would do this by creating a new feature class.  In the output feature class the ORIG_FID attribute field would be the vertex id that you'd want to label.  Granted it's not dynamic in the sense that if features are being edited, the newly created feature class would quickly be out of date.  BUT you could create a model in ModelBuilder or create a Python script.  Both could be scheduled to run daily at a certain time if you wished.

0 Kudos
DuncanHornby
MVP Notable Contributor

Just to clarify your question, you are showing the vertices whilst in EDIT mode. Are you asking for vertices to be labelled only in EDIT mode or non-edit mode or both?

Also thinking out loud this might be "dangerous" in that if you happen to be zoomed out on your data and if such a mode is turned on then you could have millions of labels being displayed which would kill any display performance...

Bud
by
Esteemed Contributor

I think both options you mentioned would be useful:

  • Vertices be labelled in EDIT mode
  • Vertices be labelled in non-edit mode (as part of a layer's labels)

Regarding the risk you mentioned, I suppose we could handle that by setting a scale tolerance on the labels in the layer. I.e. only show the labels when zoomed in to at least 1,000 scale, or whatever is appropriate.

0 Kudos
DuncanHornby
MVP Notable Contributor

I can get some way to dynamically labelled vertices but unable to figure out the last step, assigning a count to the vertex. May be someone smarter can solve that or confirm it is simply not possible?

I created a new shape layer for the polygon symbology, a green dot, and made sure marker placement was on vertices:

DuncanHornby_0-1654874864939.png

 

This creates this affect:

DuncanHornby_1-1654874951344.png

I added another shape marker but set it to TEXT form, turned on Allow symbol property connection and as way of example set the custom text to be an attribute

DuncanHornby_2-1654875090443.png

 

And you get this affect (its a location where 3 adjacent polygons come together):

DuncanHornby_3-1654875129856.png

I can't work out how to assign a changing piece of text (vertex order number) to each unique green dot, it appears to be a whole feature affect.

 

JohannesLindner
MVP Frequent Contributor

Yeah, I used that process too. My expression was something like

Count(Geometry($feature).rings[0])

which counts the vertices in the first ring of the polygon.

 

I tried (without any hope) to use a for loop:

var ring = Geometry($feature).rings[0]
for(var p in ring) {
    return ring[p]
}

 

but very unsurprisingly that just returns the dictionary of the first vertex on all of the vertices. I don't think there is a way to evaluate a symbol expression for separate vertices, just for the whole polygon. I strongly believe that to do this in ArcGIS, you have to convert the vertices to points.


Have a great day!
Johannes