| Platform: | DotSpatial |
| Task: | Add a points featureset to a map |
| Discussion: | You can add points to a map that are not associated with a shapefile or other layer type. The example below draws geographic coordinates from a DataView drawn from a DataTable and plots them on a map |
| Example: | 'make a featureset
Dim CaribouFeatureSet As FeatureSet = New FeatureSet(FeatureType.Point)
CaribouFeatureSet.Projection = KnownCoordinateSystems.Geographic.World.WGS1984
'load the gps fixes
Dim GPSFixesDataView As New DataView(Me.ARCN_CaribouDataSet.CaribouLocations, "CaribouID = '" & Me.CaribouDataGridView.CurrentRow.Cells("CaribouID").Value & "'", "CaribouID Asc", DataViewRowState.CurrentRows)
For Each Row As DataRowView In GPSFixesDataView
Dim Lat As Double = Row.Item("Lat")
Dim Lon As Double = Row.Item("Lon")
Dim MyPt As New Point(Lon, Lat)
CaribouFeatureSet.AddFeature(MyPt)
Next
CaribouMap.Layers.Add(CaribouFeatureSet) |