Plotting all airports

Downloading dand processing data

The Global Airport Database (GADB) is a FREE downloadable database of 9300 airports big and small from all around the world. The database is presented in a simple token delimited format. The database provides detailed information about the airports.

More information available on http://www.partow.net/miscellaneous/airportdatabase/

download.file("http://www.partow.net/downloads/GlobalAirportDatabase.zip",destfile = "data.zip")
unzip("data.zip")
data <- read.table("GlobalAirportDatabase.txt", sep = ":")
colnames(data) <- c("ICAOCode", "IATACode", "AirportName", "City/Town", "Country", "LatDeg", "LatdeMin", "LatSec", "LatDirec", "LongDeg", "LongdeMin", "LongdeSec", "LongDirec", "Altitude", "LatDec", "LongDec")

A look at the data

head(data)
##   ICAOCode IATACode                         AirportName    City/Town
## 1     AYGA      GKA                              GOROKA       GOROKA
## 2     AYLA      LAE                                 N/A          LAE
## 3     AYMD      MAG                              MADANG       MADANG
## 4     AYMH      HGU                         MOUNT HAGEN  MOUNT HAGEN
## 5     AYNZ      LAE                              NADZAB       NADZAB
## 6     AYPY      POM PORT MORESBY JACKSONS INTERNATIONAL PORT MORESBY
##            Country LatDeg LatdeMin LatSec LatDirec LongDeg LongdeMin
## 1 PAPUA NEW GUINEA      6        4     54        S     145        23
## 2 PAPUA NEW GUINEA      0        0      0        U       0         0
## 3 PAPUA NEW GUINEA      5       12     25        S     145        47
## 4 PAPUA NEW GUINEA      5       49     34        S     144        17
## 5 PAPUA NEW GUINEA      6       34     11        S     146        43
## 6 PAPUA NEW GUINEA      9       26     36        S     147        13
##   LongdeSec LongDirec Altitude LatDec LongDec
## 1        30         E     1610 -6.082 145.392
## 2         0         U        0  0.000   0.000
## 3        19         E        7 -5.207 145.789
## 4        46         E     1643 -5.826 144.296
## 5        34         E       73 -6.570 146.726
## 6        12         E       45 -9.443 147.220

Plotting the airports

library(leaflet)
## Warning: package 'leaflet' was built under R version 3.4.4
my_map <- leaflet() %>%
      addTiles() %>%
      addMarkers(lat=data$LatDec, lng=data$LongDec, 
                 clusterOptions = markerClusterOptions,
                 popup = paste("ICAOCode:", data$ICAOCode, "<br>",
                              "IATACode:", data$IATACode, "<br>",
                              "AirportName:", data$AirportName, "<br>",
                              "City/Town:", data$`City/Town`, "<br>",
                              "Country:", data$Country))
my_map