Select to view content in your preferred language

FeatureReduction.MaxScale hides individual graphic labels

222
2
Jump to solution
08-16-2024 06:14 AM
Labels (3)
LarsNess
Emerging Contributor

Hi Esri and ArcGISRuntime enthusiasts!

We have a problem when using GraphicsOverlay.FeatureReduction.MaxScale. When this value is set, affected graphics seem to have their default LabelDefinition hidden when clustering is not active.

Given the sample below, can anyone spot an error in the code, or is there a known problem with this?

Thanks in advance for any help!

public GraphicsOverlay CreateGraphicsOverlay()
 {
     var graphicsOverlay = new GraphicsOverlay
     {
         IsVisible = true,
         Id = "points",
         Renderer = new SimpleRenderer(new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Square, Color.Blue, 16).ToMultilayerSymbol()),
         FeatureReduction = new ClusteringFeatureReduction(new SimpleRenderer
         {
             Symbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.IndianRed, 16)
         })
         {
             //Label when clustering
             LabelDefinitions =
             {
                 new LabelDefinition
                 (
                     labelExpression: new SimpleLabelExpression(simpleExpression: "[cluster_count] CONCAT \" Items\""),
                     textSymbol: new TextSymbol {Color = Color.Black, Size = 12}
                 )
                 {
                     Placement = LabelingPlacement.PointCenterCenter,
                 }
             },
             MinSymbolSize = 50,
             
             //BUG! WHEN THIS IS SET, MANY LABELS ARE NOT VISIBLE
             MaxScale = 30_000,
         },

         //Label for individual points
         LabelsEnabled = true,
         LabelDefinitions =
                 {
                     new LabelDefinition
                     (
                         labelExpression: new SimpleLabelExpression("[Name]"),
                         textSymbol: new TextSymbol
                         {
                             Color = Color.Black,
                             Size = 12,
                             FontWeight = FontWeight.Bold,
                             BackgroundColor = Color.White,
                             HaloColor = Color.White,
                             HaloWidth = 1,
                         }
                     )
                     {
                         Placement = LabelingPlacement.PointBelowCenter,
                     },
                 },

         RenderingMode = GraphicsRenderingMode.Dynamic,
     };

     var random = new Random();
     for (var i = 0; i < 100; i++)
     {
         const double OsloN = 59.95138;
         const double OsloS = 59.91070;
         const double OsloE = 10.80758;
         const double OsloW = 10.70544;

         var x = OsloW + random.NextDouble() * (OsloE - OsloW);
         var y = OsloS + random.NextDouble() * (OsloN - OsloS);

         var graphic = new Graphic(new MapPoint(x, y, SpatialReferences.Wgs84))
         {
             IsVisible = true,
         };
         graphic.Attributes["Name"] = $"Point {i}";
         graphicsOverlay.Graphics.Add(graphic);
     }
     
     return graphicsOverlay;

 }

 

0 Kudos
1 Solution

Accepted Solutions
PreetiMaske
Esri Regular Contributor

Thanks for reporting the issue, I am able to reproduce the problem. I have logged an internal issue and will investigate this shortly.

 

Thanks,

Preeti

 

View solution in original post

0 Kudos
2 Replies
PreetiMaske
Esri Regular Contributor

Thanks for reporting the issue, I am able to reproduce the problem. I have logged an internal issue and will investigate this shortly.

 

Thanks,

Preeti

 

0 Kudos
LarsNess
Emerging Contributor

Thanks for looking into this!

0 Kudos