This project has moved and is read-only. For the latest updates, please go here.

Adding attributes to a point

Topics: Algorithms, CompactFramework, SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Apr 29, 2015 at 4: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
vectorLayer.DataSource = New SharpMap.Data.Providers.GeometryProvider(geomColl)
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

Apr 29, 2015 at 7:21 PM
Create yourself a SharpMap.Data.FeatureDataTable and use a SharpMap.Data.Providers.GeometryFeatureProvider.
Apr 30, 2015 at 9:48 AM
how do i connect with the vector layer ?
any ref i can read
Apr 30, 2015 at 1:40 PM
The repository is full of example code, especially the Examples\WinFormSamples project.
Here is one for a connection to a PostGIS database
May 17, 2015 at 4:42 AM
thank you so much it worked well