Display some points in VB

Topics: General Topics
Nov 2, 2006 at 8:06 PM
I'd like to draw a point, but I'm using VB. I don't know where is the problem

here is the code:

'map
map = New SharpMap.Map(MapImage1.Size)

'track
Dim layer As New SharpMap.Layers.VectorLayer("track")

Dim GeomColl As New Collection(Of SharpMap.Geometries.Geometry)
GeomColl.Add(New SharpMap.Geometries.Point(10, 10))

layer.DataSource = New SharpMap.Data.Providers.GeometryProvider(GeomColl)
map.Layers.Add(layer)
map.ZoomToExtents()
Jul 15, 2007 at 2:12 AM
This works for me using an ImageMap component in a form (note that Layer3 has an index of 2 here, as there were 2 previous layers added):

Dim Layer3 As New SharpMap.Layers.VectorLayer("Layer3")
Dim PointColl As New System.Collections.Generic.List(Of SharpMap.Geometries.Geometry)

MapImage1.Map.Layers.Add(Layer3)
Layer3.DataSource = New SharpMap.Data.Providers.GeometryProvider(PointColl)

PointColl.Add(New SharpMap.Geometries.Point(-50.6786, -21.51))
PointColl.Add(New SharpMap.Geometries.Point(-50.67875, -21.515))
PointColl.Add(New SharpMap.Geometries.Point(-50.67865, -21.525))
PointColl.Add(New SharpMap.Geometries.Point(-50.6784, -21.52))
PointColl.Add(New SharpMap.Geometries.Point(-50.67833, -21.53))
PointColl.Add(New SharpMap.Geometries.Point(-50.67825, -21.531))

MapImage1.Map.ZoomToBox(MapImage1.Map.Layers(2).Envelope)
MapImage1.Map.Zoom = MapImage1.Map.Zoom * 1.1
MapImage1.Refresh()