Select to view content in your preferred language

Is Labelling Graphics Possible in Quartz 100?

2287
10
Jump to solution
04-18-2017 01:37 PM
JamesRichards1
Regular Contributor

In 10.2.7 we had ability to label Graphics as explained here:

Label map features—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Is this functionality missing in Quartz 100? Or am I just not finding it in the documentation? 

If this is not available, is it going to be in the next release? We are in the middle of upgrading to Quartz but will have to backslide to 10.2.7 if there is no viable way to label graphics. Labeling them 1 at a time with Text Symbol is not going to work as we need the nice conflict detection that was available in 10.2.7.

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

We're hoping to have this available in Update 1.

View solution in original post

0 Kudos
10 Replies
dotMorten_esri
Esri Notable Contributor

We're hoping to have this available in Update 1.

0 Kudos
JamesRichards1
Regular Contributor

Thank you for the quick reply.

0 Kudos
JenniferLink
Occasional Contributor

Is labeling now available at 100.1? And if so, is there a good sample I can follow?

Thanks!

Jen

0 Kudos
ChuckKnaab
Emerging Contributor

Hi Morten Nielsen

I'm using the 100.6 runtime and have looked quite a bit at the pages you linked to as well as trying the code sample from the bottom link.  Labels work as expected for feature layers, but I'm not able to get labels to show up on graphics. Is there a code sample out there you can point me to on how to accomplish what's listed in the documentation as being supported?  

Thanks, 

CK

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Yes, labels are supported on GraphicsOverlays - for more information see:

Add labels—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Show labels on layers | ArcGIS for Developers (the sample is for FeatureLayer but the workflow is the same)

Cheers

Mike

0 Kudos
ChuckKnaab
Emerging Contributor

Thanks for the quick reply Mike.  I've been working through issues this morning. I've had a few syntax errors and such that I've been able to work through, but one thing I'm still struggling with now is to create a labeling expression that uses a property that's stored in the Graphic.Attributes dictionary.  When labeling FeatureLayers, the $feature global variable is available. Does that variable also apply to a graphic object? The documenation here: Profiles | ArcGIS for Developers says the type for that variable is a "Feature" (Type System | ArcGIS for Developers ) and I wasn't sure if a graphic is also included in that or not.  I've tried things like: 

""labelExpressionInfo"": {
 ""expression"": ""return $feature.Attributes[\""MyFieldKey\""] + \"" (arcade)\"";""
 }‍‍‍

However, I either run into parsing errors or nothing shows up on the map.  Ideally, I'd check to see if the key exists in the dictionary, then return the value in that case, but have also not had luck with conditional statements in the labeling expression.  Is there something I'm missing?

0 Kudos
ChuckKnaab
Emerging Contributor

Hi Michael Branscomb‌,

Have you had a chance to review my comment above?  Do you have any recommendations?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Chuck,

Labeling by the attribute should work via: "$feature.Name" or "$feature["name"]".

If you want to append strings, then you can use something like this "$feature.name + ' Street'".

And finally functions/evaluations should work e.g. "if ($feature.id > 20) $feature.name + ' St'; else $feature.LongName + ' ' + $feature.ending".

Regards

Mike

0 Kudos