How do I get the Label String of a Feature?

155
2
07-04-2018 10:58 AM
DanielKilimnik
New Contributor

Is there a way to get the String a Feature would have as a Label? I saw you have the LabelingInfo and the LabelDefinition classes but I can't find a way to get the String. As far as I saw you can only get the LabelExpression but it would be a very tedious task to parse this into the right String.

I am using the latest ArcGis Runtime version 100.2.1

I hope someone can help me. Thanks in advance.

Tags (2)
0 Kudos
2 Replies
EricBader
Regular Contributor II

Hi Daniel.

String ldString = featureLayer.getLabelDefinitions().get(0).toJson();

if 'featureLayer' has at least 1 labelDefinition, calling toJson() will give you the serialized representation of that. In that string, you'll see the "Expression" value of where the text for that label comes from. 

Is this what you're looking for?

Also see Show Labels on Layer—ArcGIS Runtime SDK for Android | ArcGIS for Developers .

0 Kudos
DanielKilimnik
New Contributor

No it's not really what I am looking for. I don't want the expression of where the text for the label comes from. I want the final text of the label. If you compare it to a renderer there you can get the symbol of each feature and I want the same but for the labels.

Am 9. Juli 2018, 06:57, um 06:57, Eric Bader <geonet@esri.com> schrieb:

>Eric Bader

>[https://community.esri.com/people/ebader-esristaff?et=watches.email.thread]

>replied to the discussion

>"Re: How do I get the Label String of a Feature?"

>To view the discussion, visit:

>https://community.esri.com/message/783444-re-how-do-i-get-the-label-string-of-a-feature?commentID=783444&et=watches.email.thread#comment-783444

>

0 Kudos