ThinkGeo.com    |     Documentation    |     Premium Support

Any way to indicate road names should be displayed on top of other geometry?

Is there an attribute to force road names or other labels to always be displayed on top of all layers without having to reorder?

Hi Robert,

There is no any attribute to force labels to always be displayed on top of all layers without having to reorder. The Labels always have the highest priority in one overlay, it means that the labels always are displayed on the top of all layers in one overlay.

There is an option to display the labels on top of all layers which in the different overlays.

  1. Add the text features which should be displayed on the top of all layers to an InMemoryFeatureLayer.
  2. Add the InMemoryFeatureLayer into a new LayerOverlay.
  3. Add the new LayerOverlay to the last position of Map.Overlays.

The code maybe as the following:

InMemoryFeatureLayer labelsLayer = new InMemoryFeatureLayer(columns); // create an InMemoryFeatureLayer.
        
labelsLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Country1("CNTRY_NAME");
labelsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
foreach (var feature in features) // add the labels features into the labels layer.
{
     labelsLayer.InternalFeatures.Add(feature);
}
LayerOverlay labelsOverlay = new LayerOverlay(); // create a new overlay.
labelsOverlay.Layers.Add(labelsLayer); // add the labels layer into the overlay.

winformsMap1.Overlays.Add(labelsOverlay); // add the overlay to the last position.

If something misunderstood here, please let us know.

Thanks,
Peter

Thanks Peter. That answers my question.

Robert

Hi Robert,

It’s my pleasure.

Thanks,
Peter