Show Labels

Labels are a textual representation on the map that usually convey information about ancillary attribute data that correspond to the vector shape. In the example below, a very simple label setup is used, where the labels are always visible, and whatever value appears in the first column of the data table for that featureset will be used to generate the label. Notice that the name is encapsulated in square brackets. The LabelSymbolizer contains lots of different properties that affect the appearance of all the labels, but the text of the labels in this case will be supplied by the attributes.


Private Sub AddLabels()
    Dim fl As IFeatureLayer = geoMap1.AddFeatureLayer()
    Dim expression As String = "[" & fl.DataSet.DataTable.Columns(0).ColumnName & "]"
    Dim ls As New LabelSymbolizer()
    ls.Orientation = ContentAlignment.MiddleCenter
    geoMap1.AddLabels(fl, expression, "", ls)
End Sub

Last edited Feb 27, 2010 at 1:38 AM by Shade1974, version 2


No comments yet.