Adding attributes to a point

Topics: Algorithms, CompactFramework, SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Apr 29, 2015 at 3:11 PM
i m making points using the following code
Dim strFile = strLayer & "-" & DateAndTime.Now.Date.DayOfYear & "-" & DateAndTime.Now.Minute & "-" & DateAndTime.Now.Second & ".wkt"
    Dim vectorLayer As SharpMap.Layers.VectorLayer = New SharpMap.Layers.VectorLayer(strLayer)
    Dim geomColl = New List(Of GeoAPI.Geometries.IGeometry)
    GeoAPI.GeometryServiceProvider.Instance = New NetTopologySuite.NtsGeometryServices()

    Dim gf = NetTopologySuite.NtsGeometryServices.Instance.CreateGeometryFactory

    Dim coord As GeoAPI.Geometries.Coordinate = New GeoAPI.Geometries.Coordinate(x, y)

    Dim p1 As System.Drawing.PointF = frmMain.mapbxMain.Map.WorldToImage(coord)
    Dim ncoord = frmMain.mapbxMain.Map.ImageToWorld(p1)

    '//Add a single Point
    geomColl.Add(gf.CreatePoint(ncoord))
vectorLayer.DataSource = New SharpMap.Data.Providers.GeometryProvider(geomColl)
mapbxMain.Map.Layers.Add(vectorLayer)
mapbxMain.Map.ZoomToExtents()
mapbxMain.Refresh()
how can i add data from a database which has coordinate data and sum attributes to this vector which can be referenced laterby
Dim p = mapbxMain.Map.ImageToWorld(e.Location)
        ' Dim p = SharpMap.Utilities.Transform.MapToWorld(New PointF(imagePos.X, imagePos.Y), mapbxMain.Map)
        ' Dim ds As FeatureDataSet = New FeatureDataSet
        Dim env = New GeoAPI.Geometries.Envelope(p)

        For Each layer In mapbxMain.Map.Layers
            Dim queryLayer As SharpMap.Layers.ICanQueryLayer = layer
            If queryLayer.IsQueryEnabled Then
                If Not (queryLayer.GetType.ToString = "SharpMap.Layers.GdalRasterLayer") Then
                      queryLayer.ExecuteIntersectionQuery(env, ds)
                End If
            End If

        Next
Coordinator
Apr 29, 2015 at 6:21 PM
Create yourself a SharpMap.Data.FeatureDataTable and use a SharpMap.Data.Providers.GeometryFeatureProvider.
Apr 30, 2015 at 8:48 AM
how do i connect with the vector layer ?
any ref i can read
Coordinator
Apr 30, 2015 at 12:40 PM
The repository is full of example code, especially the Examples\WinFormSamples project.
Here is one for a connection to a PostGIS database https://sharpmap.codeplex.com/SourceControl/latest#Branches/1.0/Examples/WinFormSamples/Samples/PostGisSample.cs
May 17, 2015 at 3:42 AM
thank you so much it worked well