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

Platform:DotSpatial
Task:Add a point to a map without creating a shapefile
Discussion:
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.
Example:
    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)
        MyPointFeatureSet.AddFeature(MyFeature)

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

        'refresh the map
        Map.ResetBuffer()
    End Sub
Back to Index