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.
Solved! Go to Solution.
We're hoping to have this available in Update 1.
We're hoping to have this available in Update 1.
Thank you for the quick reply.
Is labeling now available at 100.1? And if so, is there a good sample I can follow?
Thanks!
Jen
Yup:
The full labeling API didn't make it into v100.1, so unfortunately you currently set them using the JSON format from the REST/Webmap specification:
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
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
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?
Hi Michael Branscomb,
Have you had a chance to review my comment above? Do you have any recommendations?
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