MapWindow: Draw a spatially referenced point without the bother of building a shapefile

Platform:MapWindow
Task:Draw a spatially referenced point without the bother of building a shapefile
Discussion:
You don't actually need a shapefile to show points on a map. You can merely draw spatially referenced and labeled points. Here is a snippet that shows you how. This assumes you have a Map object built up already and a button used to add the points.
Example:
    Private Sub AddPointButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddPointButton.Click
        LoadPoint(67.346, -155.4985, "A labeled point", Map)
        LoadPoint(66.7867, -151.46789, "BEAR!!!", Map)
        LoadPoint(68.34, -162.4678, "I think I'll have a picnic here", Map)
    End Sub

    Public Sub LoadPoint(ByVal Latitude As Double, ByVal Longitude As Double, ByVal LabelText As String, ByVal Map As AxMapWinGIS.AxMap)
        Dim DrawingLayerHandle As Integer
        DrawingLayerHandle = Map.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
        Map.DrawCircle(Longitude, Latitude, 3, System.Convert.ToUInt32(RGB(255, 0, 0)), True)
        Map.AddDrawingLabel(DrawingLayerHandle, LabelText, System.Convert.ToUInt32(RGB(255, 0, 0)), Longitude, Latitude, tkHJustification.hjCenter)
    End Sub
Back to Index