Hi
I am displaying icons from the database successfully. But I need to display text ‘ ColumnValue(“Name”)’ on left of each icon. I tried samples howdoIsamples/Labeling. But could not get help according to my requirement. Kindly suggest me updates in my following code.
Sub load_Units()
Dim dt As New DataTable
Dim i As Integer
Dim pointLayer As New InMemoryFeatureLayer()
Dim iconValueStyle As New IconValueStyle
dt = getTable("select * from Units", "")
pointLayer.FeatureSource.Projection = proj
pointLayer.Open()
pointLayer.Columns.Add(New FeatureSourceColumn("Type", "string", 20))
pointLayer.Columns.Add(New FeatureSourceColumn("NAME", "string", 20))
Dim textStyle As TextStyle = New TextStyle("NAME", New GeoFont(Me.Font.FontFamily.Name, 10), New GeoSolidBrush(GeoColor.StandardColors.Black))
For i = 0 To dt.Rows.Count - 1
Dim Coordinates As New Feature(New PointShape(dt.Rows(i).Item("Longitude"), dt.Rows(i).Item("Latitude")))
iconValueStyle.ColumnName = "Type"
iconValueStyle.IconValueItems.Add(New IconValueItem(dt.Rows(i).Item("Recid"), New GeoImage("..\..\Images\primary_symbols\" & dt.rows(i).item("Symbol_Name"), textStyle))
pointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(iconValueStyle)
Coordinates.ColumnValues.Add("NAME","Unit#" & i)
Coordinates.ColumnValues.Add("Type", dt.Rows(i).Item("Recid"))
pointLayer.InternalFeatures.Add(Coordinates)
pointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(iconValueStyle)
Next
pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim UnitOverlay As New LayerOverlay()
UnitOverlay.Layers.Add("UnitOverlay", pointLayer)
winformsMap1.Overlays.Add(UnitOverlay)
End Sub
Regards,
Zeeshan