Make a Label layer with wkt source?

Jul 31, 2008 at 10:50 PM
I try to put label on a points from a geometrycollection, but the samples not work (not show any), need a layer with a point and a label in this point.

this code not work:

        Dim _layerPuntoTabla As SharpMap.Layers.LabelLayer = New SharpMap.Layers.LabelLayer("labelLayer")
        Dim labelData As SharpMap.Data.FeatureDataTable = New SharpMap.Data.FeatureDataTable
        labelData.Columns.Add("Punto", GetType(String))
        Dim r As SharpMap.Data.FeatureDataRow = labelData.NewRow()
        r("Punto") = "my Lair"
        r.Geometry = New SharpMap.Geometries.Point(198, 483)

        Dim _geometriaPuntoTabla As SharpMap.Data.FeatureDataTable = Nothing
        _layerPuntoTabla.DataSource = New SharpMap.Data.Providers.GeometryFeatureProvider(labelData)
        _layerPuntoTabla.Enabled = True
        _layerPuntoTabla.LabelColumn = "Punto"
        _layerPuntoTabla.Style.Font = New Font("Arial", 20, FontStyle.Bold, GraphicsUnit.Point)
        _layerPuntoTabla.Style.Enabled = True

        Dim layLabel As New SharpMap.Layers.LabelLayer("Punto")
        layLabel.DataSource = _layerPuntoTabla.DataSource
        layLabel.Enabled = True
        layLabel.LabelColumn = "Punto"

and after try to show, not have errors but not show any.
Coordinator
Aug 1, 2008 at 7:37 AM
Hi ojarana, i think you forgot to add the new row to the FeatureDataTable's rows collection hth jd