ThinkGeo.com    |     Blog    |     Wiki    |     Support

Make all labels show regardless of overlap

I’m having issues getting all labels to show up regardless of zoom level. Right now, if labels overlap then only one is shown until I zoom in closer. The user doesn’t want that. They want the labels to all show and stack regardless if they overlap or not.

I’ve tried a few things:

  • On the TextStyle for the labels, I’ve set OverlappingRule = LabelOverlappingrule.AllowOverlapping
  • I’ve set LabelDuplicateRule.UnlimitedDuplicateLabels
  • DrawingLevel = DrawingLevel.LabelLevel
  • SuppressPartialLabels = false

Still, overlapping labels disappear until certain zoom levels.

Could this have anything to do with the fact that I have custom zoom levels?

I made a ZoomLevelSet with extra ZoomLevels and set my Map’s ZoomLevelSet to that. However, I didn’t set each layer’s ZoomLevelSet to it, because I assumed since the map was already set to it, it would automatically set the layers. Is this true?

Here’s an example of how I’m setting custom zoom levels:

var partitionedZoomLevelSet = new ZoomLevelSet(); //make custom zoom levels to zoom in further than default
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMapZoomLevelSet.GetZoomLevels()[0].Scale));//Zoo
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[1].Scale));//Zoo
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[2].Scale)); //Zo
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[3].Scale)); //Zo
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[4].Scale)); //Zo
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[5].Scale));  //Z
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[6].Scale));  //Z
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[7].Scale));  //Z
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[8].Scale));   //
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[9].Scale));   //
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[10].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[11].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[12].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[13].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[14].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[15].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[16].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[17].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[18].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[19].Scale));   /
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 2));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 4));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 6));
partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(MyMap.ZoomLevelSet.GetZoomLevels()[19].Scale / 8));

MyMap.ZoomLevelSet = partitionedZoomLevelSet;

Again, I don’t set these for my layers because I assumed it would inherit from the map’s zoomlevel.

Hi Dan,

I think your code should works like this:

And here is the sample: 9583.zip (101.8 KB)

If I misunderstand it you can modify it and upload new sample.

Regards,

Ethan

Thanks Ethan! Seems to work good.

Hi Dan,

I am glad to hear that’s helpful.

Regards,

Ethan

hi Ethan,

I wanted to download 9583.zip to see how you solved this issue. When I press the link my Edge browser gives me a warning that the site is not secure.

Would you verify the link and make sure it is safe to download?

Thanks,
Dennis

Hi Dennis,

Don’t worry about the attachment file, it’s not outer link, it’s generated by our forum.

I am not sure why Edge browser give warning, maybe that’s because our sever is located in Amazon AWS.

Regards,

Ethan