And now for something completely different

Click on image for full size version.

This is a MapPoint image of the airports that I have landed at mainly while taking flying lessons. To produce this or to produce something like it (e.g. any set of locations), you need

  1. Your own copy of MapPoint (I have the 2006 version)
  2. An Excel file with the latitudes and longitudes of each location you want to display (I got these from http://www.Airnav.com)
  3. Some name you wish to appear on the map (I used the airport names and identifiers) – save the file as the 2003 version 
  4. The following VBA code, modified to your situation
    1. To add the code in Excel, press alt F11
    2. Add a module
    3. Copy and paste the code
    4. Set a reference to Microsoft MapPoint Control 13.0
  5. Open MapPoint
  6. Run the module
  7. Save the picture

VBA Code

Sub OpenDataSet()
    Dim objApp As MapPoint.Application
    Dim oMap As MapPoint.Map
    Dim objDataSets As MapPoint.DataSets
    Dim objDataSet As MapPoint.DataSet
    Dim zDataSource As String
    Dim objRS As MapPoint.Recordset
    Dim ppin As MapPoint.Pushpin

    Set objApp = GetObject(, “MapPoint.Application”)
    Set oMap = objApp.ActiveMap
    ”’ This is where your Excel file is located. Use the 2003 format
    zDataSource = “C:\Jan8100\JansData\HomeStuff\Pilot\JKAirports.xls!Sheet1!A1:F23″
   
    Set objDataSets = objApp.ActiveMap.DataSets
    Set objDataSet = objDataSets.ImportData(zDataSource, , _
            geoCountryDefault, _
            geoDelimiterComma, _
            geoImportFirstRowIsHeadings)
   ”’ This is a purple plane. For other symbols, go to
   ”’ http://msdn.microsoft.com/en-us/library/aa493300.aspx
    objDataSet.Symbol = 89
    Set objRS = objDataSet.QueryAllRecords
        objRS.MoveFirst
        Do While Not objRS.EOF
            Set ppin = objRS.Pushpin
            ppin.Highlight = True
            ”’ The first column in the Excel data set
            ”’ is the airport name and the fourth columns
            ”’ is the airport identifier
            ppin.Name = objRS.Fields(1).Value & “(” & objRS.Fields(4).Value & “)”
            ppin.BalloonState = geoDisplayName
            objRS.MoveNext
        Loop
End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: