Global Navigation Bar

MapInfo Products Knowledge Base


Product: MapXtreme 2004/2005
Version: 6.0, 6.1, 6.2, 6.5
Platform: Not Platform Related
Category: Labels

Summary:
How to remove duplicate labels from a label layer.

Question:
How to remove duplicate labels from a label layer.

Answer:

Hide details for C# Code:C# Code:

MapInfo.Mapping.FeatureLayer fl = this.mapControl1.Map.Layers["USCTY_1k"] as MapInfo.Mapping.FeatureLayer;

MapInfo.Mapping.LabelLayer labelLayer = new MapInfo.Mapping.LabelLayer("CityLabels");
MapInfo.Mapping.LabelSource labelSource = new MapInfo.Mapping.LabelSource(fl.Table);

labelSource.DefaultLabelProperties.Caption = "State";
labelSource.DefaultLabelProperties.Visibility.AllowDuplicates = false;

labelLayer.Sources.Append(labelSource);
this.mapControl1.Map.Layers.Add(labelLayer);
    Hide details for VB.Net Code:VB.Net Code:
      Dim fl As MapInfo.Mapping.FeatureLayer = Me.MapControl1.Map.Layers("USCTY_1k")

      Dim labelLayer As New MapInfo.Mapping.LabelLayer("CityLabels")
      Dim labelSource As New MapInfo.Mapping.LabelSource(fl.Table)

      labelSource.DefaultLabelProperties.Caption = "State"
      labelSource.DefaultLabelProperties.Visibility.AllowDuplicates = False

      labelLayer.Sources.Append(labelSource)
      Me.MapControl1.Map.Layers.Add(labelLayer)

        Last Modified: 04/13/2006 02:46:29 PM
        Global Navigation Bar