DotSpatial: Add a point to a map without creating a shapefile

Task:Add a point to a map without creating a shapefile
You want to add a point to the map but don't want to go to all the trouble of creating a shapefile. Here is a way to draw quickly a cartoon point on the map.
    Private Sub AddAPoint()
        'the new point feature set
        Dim MyPointFeatureSet As New FeatureSet(FeatureType.Point)
        MyPointFeatureSet.Projection = Map.Projection

        'make a coordinate, add it to the featureset
        Dim MyCoordinate As New Coordinate
        MyCoordinate.X = -155
        MyCoordinate.Y = 65
        Dim MyPoint As New DotSpatial.Topology.Point(MyCoordinate)
        Dim MyFeature As IFeature = MyPointFeatureSet.AddFeature(MyPoint)

        'add the featureSet as map layer
        Dim MyMapPointLayer As MapPointLayer = Map.Layers.Add(MyPointFeatureSet)
        MyMapPointLayer.LegendText = "Skeeter's Points"

        'refresh the map
    End Sub
Back to Index