How to show labels on a Route feature class at specific distance using ArcGIS Pro SDK

706
2
09-07-2021 03:20 AM
by Anonymous User
Not applicable

Hi,

We have a route feature class and would like to place labels on it at specific distances. As shown in the screenshot below, we are looking for the same result. Labels are mentioned at certain distances, which are highlighted in yellow.

However We are not sure how  we can achieve this using ArcGIS Pro SDK.

 

Can anyone please provide the basic sample(in C#) for the same.

Expected Output:

ShabinaBano_0-1631009794845.png

 

Thanks in advance.

2 Replies
KirkKuykendall1
Occasional Contributor III

If the screenshot shown is not from ArcGIS Pro, create a featurelayer that visually meets your requirements via the GUI, as described here.

Save it the layer to a .lyrx file, and view it with a text editor, examining the CIM classes therein.

KirkKuykendall1_0-1631045757596.png

 

Write code that instantiates the CIM renderer class, and set the properties to whatever appears in the lyrx file.  Finally, use SetRenderer to assign the renderer to the featurelayer.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I attached a sample that uses the graphics layer in order to add the labels to your map.   The sample uses a selected polyline (feature) and creates labels at a distance of 200 meters along the selected line (depending on the linear unit of your projection)

Wolf_0-1631140172738.png

 

0 Kudos