DuplicateLabels.PreserveDuplicates Not Respected in GraphicsLayer

5236
5
11-13-2014 10:16 AM
BenPalmer
New Contributor

If I use an AttributeLabelClass in the 10.2.4 .NET SDK on a GraphicsLayer that displays the same text on two nearby linear features, one of the labels will disappear if both labels are in the extent even if the DuplicateLabels property on the AttributeLabelClass is set to DuplicateLabels.PreserveDuplicates. I have tried to change the LabelPriority to Highest and LabelPlacement to FixedPositionWithOverlaps but these options did not prevent the nearby duplicates from getting removed. Has anyone else seen this issue or have a workaround?

Tags (1)
0 Kudos
5 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Please can you post your repro app which demonstrates the problem?

FixedPositionWithOverlaps should force all labels to be placed.

Cheers

Mike

0 Kudos
BenPalmer
New Contributor

Michael,

Sorry for the slow reply. A bit busy around the holidays. Here is a link to a repository demonstrating the issue. The behavior is only evident when polylines have a coincidental end point with another polyline that has the same label value. Thanks for taking a look.

https://github.com/IUsername/LabellingIssue

0 Kudos
RexHansen
Esri Contributor

Hi Ben,

  I've reproduced the problem and logged as an issue.   It appears to occur when lines share a vertex and have the same label value.  Forked repo with some updates to illustrate: rexhansen/LabellingIssue · GitHub

Thanks

-Rex

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi Ben,

In the updated labeling support in ArcGIS Runtime SDK .NET v100.1, we now have a property called lineConnection that takes one of "none", "minimizeLabels", or "unambiguousLabels". For more info see:

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

And:

labelingInfo | ArcGIS for Developers 

There are some differences between the v10.2.x API and the v100.x API, including the fact that the current 100.1 labeling API is based on definitions from JSON. We are working on a full .NET public API for these definitions in a future release.

TextSymbol textSymbol = new TextSymbol()
{
    Color = Colors.DarkRed,
    FontFamily = "Arial",
    Size = 10,
};

string json = "{\"labelExpressionInfo\":{\"expression\":\"return $feature.LENGTH;\"},\"labelPlacement\":\"esriServerLinePlacementAboveAlong\",\"symbol\":" + textSymbol.ToJson() + "}";
layer.LabelsEnabled = true;
LabelDefinition labelDefinition = LabelDefinition.FromJson(json);
layer.LabelDefinitions.Add(labelDefinition);

Cheers

Mike

MichaelBranscomb
Esri Frequent Contributor

Hi,

This should be resolved in the recent v100.2 release.

Please download the latest Visual Studio extension from ArcGIS for Developers or update your NuGet packages via the NuGet package manager.

Cheers

Mike

0 Kudos