library(ggplot2)
library(tidyverse)
library(reshape)
This project uses ggplot2 and airport data drawn from https://ourairports.com/data/ to map airport/heliport locations around the globe.
# create world data frame
world<-map_data("world")
# check contents of world data frame
str(world)
## 'data.frame': 99338 obs. of 6 variables:
## $ long : num -69.9 -69.9 -69.9 -70 -70.1 ...
## $ lat : num 12.5 12.4 12.4 12.5 12.5 ...
## $ group : num 1 1 1 1 1 1 1 1 1 1 ...
## $ order : int 1 2 3 4 5 6 7 8 9 10 ...
## $ region : chr "Aruba" "Aruba" "Aruba" "Aruba" ...
## $ subregion: chr NA NA NA NA ...
# inspect countries/regions
table(world$region)
##
## Afghanistan Albania
## 410 113
## Algeria American Samoa
## 383 8
## Andorra Angola
## 19 338
## Anguilla Antarctica
## 6 4658
## Antigua Argentina
## 12 1039
## Armenia Aruba
## 146 10
## Ascension Island Australia
## 11 1804
## Austria Azerbaijan
## 272 264
## Azores Bahamas
## 67 268
## Bahrain Bangladesh
## 13 384
## Barbados Barbuda
## 9 10
## Belarus Belgium
## 321 163
## Belize Benin
## 65 147
## Bermuda Bhutan
## 8 100
## Bolivia Bonaire
## 418 10
## Bosnia and Herzegovina Botswana
## 146 221
## Brazil Brunei
## 1885 56
## Bulgaria Burkina Faso
## 179 255
## Burundi Cambodia
## 78 221
## Cameroon Canada
## 350 11573
## Canary Islands Cape Verde
## 94 87
## Cayman Islands Central African Republic
## 36 324
## Chad Chagos Archipelago
## 291 17
## Chile China
## 2006 2710
## Christmas Island Cocos Islands
## 9 26
## Colombia Comoros
## 623 35
## Cook Islands Costa Rica
## 11 133
## Croatia Cuba
## 374 305
## Curacao Cyprus
## 10 100
## Czech Republic Democratic Republic of the Congo
## 240 609
## Denmark Djibouti
## 298 56
## Dominica Dominican Republic
## 10 112
## Ecuador Egypt
## 347 253
## El Salvador Equatorial Guinea
## 74 67
## Eritrea Estonia
## 192 195
## Ethiopia Falkland Islands
## 302 149
## Faroe Islands Fiji
## 63 267
## Finland France
## 571 605
## French Guiana French Polynesia
## 127 185
## French Southern and Antarctic Lands Gabon
## 119 271
## Gambia Georgia
## 73 164
## Germany Ghana
## 568 217
## Greece Greenland
## 923 2240
## Grenada Grenadines
## 9 39
## Guadeloupe Guam
## 35 12
## Guatemala Guernsey
## 115 7
## Guinea Guinea-Bissau
## 348 155
## Guyana Haiti
## 287 112
## Heard Island Honduras
## 15 207
## Hungary Iceland
## 214 453
## India Indonesia
## 1518 3715
## Iran Iraq
## 605 233
## Ireland Isle of Man
## 315 15
## Israel Italy
## 105 601
## Ivory Coast Jamaica
## 294 48
## Japan Jersey
## 1097 9
## Jordan Kazakhstan
## 96 1140
## Kenya Kiribati
## 225 212
## Kosovo Kuwait
## 72 67
## Kyrgyzstan Laos
## 388 390
## Latvia Lebanon
## 140 62
## Lesotho Liberia
## 77 139
## Libya Liechtenstein
## 257 15
## Lithuania Luxembourg
## 155 46
## Madagascar Madeira Islands
## 266 12
## Malawi Malaysia
## 245 509
## Maldives Mali
## 22 476
## Malta Marshall Islands
## 16 47
## Martinique Mauritania
## 22 321
## Mauritius Mayotte
## 19 15
## Mexico Micronesia
## 1015 49
## Moldova Monaco
## 149 7
## Mongolia Montenegro
## 736 92
## Montserrat Morocco
## 7 368
## Mozambique Myanmar
## 469 842
## Namibia Nauru
## 235 8
## Nepal Netherlands
## 202 282
## Nevis New Caledonia
## 7 127
## New Zealand Nicaragua
## 775 176
## Niger Nigeria
## 255 364
## Niue Norfolk Island
## 8 26
## North Korea North Macedonia
## 257 81
## Northern Mariana Islands Norway
## 46 1985
## Oman Pakistan
## 243 571
## Palau Palestine
## 21 50
## Panama Papua New Guinea
## 246 764
## Paraguay Peru
## 257 589
## Philippines Pitcairn Islands
## 1238 9
## Poland Portugal
## 316 186
## Puerto Rico Qatar
## 69 34
## Republic of Congo Reunion
## 323 15
## Romania Russia
## 274 7354
## Rwanda Saba
## 83 8
## Saint Barthelemy Saint Helena
## 11 7
## Saint Kitts Saint Lucia
## 13 10
## Saint Martin Saint Pierre and Miquelon
## 7 24
## Saint Vincent Samoa
## 10 27
## San Marino Sao Tome and Principe
## 14 22
## Saudi Arabia Senegal
## 436 243
## Serbia Seychelles
## 267 8
## Siachen Glacier Sierra Leone
## 21 126
## Singapore Sint Eustatius
## 9 9
## Sint Maarten Slovakia
## 7 145
## Slovenia Solomon Islands
## 132 335
## Somalia South Africa
## 222 442
## South Georgia South Korea
## 55 260
## South Sandwich Islands South Sudan
## 8 326
## Spain Sri Lanka
## 448 92
## Sudan Suriname
## 447 184
## Swaziland Sweden
## 38 593
## Switzerland Syria
## 187 170
## Taiwan Tajikistan
## 68 369
## Tanzania Thailand
## 376 578
## Timor-Leste Tobago
## 70 8
## Togo Tonga
## 134 32
## Trinidad Tunisia
## 30 186
## Turkey Turkmenistan
## 562 433
## Turks and Caicos Islands Uganda
## 29 180
## UK Ukraine
## 990 678
## United Arab Emirates Uruguay
## 183 143
## USA Uzbekistan
## 5753 584
## Vanuatu Vatican
## 186 12
## Venezuela Vietnam
## 567 613
## Virgin Islands Wallis and Futuna
## 42 16
## Western Sahara Yemen
## 229 225
## Zambia Zimbabwe
## 377 170
# plot world map
ggplot()+
geom_map(
data = world, map = world,
aes(long, lat, map_id = region),
color = "blue", fill = "yellow", size = 0.2)
## Warning: Ignoring unknown aesthetics: x, y
# load airport data
airports<-read.csv("C:\\Users\\Jaire\\OneDrive\\Desktop\\Exploratory Research\\Geography\\airports.csv")
# inspect airport data
str(airports)
## 'data.frame': 74625 obs. of 18 variables:
## $ id : int 6523 323361 6524 6525 6526 322127 6527 6528 324424 322658 ...
## $ ident : chr "00A" "00AA" "00AK" "00AL" ...
## $ type : chr "heliport" "small_airport" "small_airport" "small_airport" ...
## $ name : chr "Total Rf Heliport" "Aero B Ranch Airport" "Lowell Field" "Epps Airpark" ...
## $ latitude_deg : num 40.1 38.7 59.9 34.9 35.6 ...
## $ longitude_deg : num -74.9 -101.5 -151.7 -86.8 -91.3 ...
## $ elevation_ft : int 11 3435 450 820 237 1100 3810 3038 87 3350 ...
## $ continent : chr NA NA NA NA ...
## $ iso_country : chr "US" "US" "US" "US" ...
## $ iso_region : chr "US-PA" "US-KS" "US-AK" "US-AL" ...
## $ municipality : chr "Bensalem" "Leoti" "Anchor Point" "Harvest" ...
## $ scheduled_service: chr "no" "no" "no" "no" ...
## $ gps_code : chr "00A" "00AA" "00AK" "00AL" ...
## $ iata_code : chr "" "" "" "" ...
## $ local_code : chr "00A" "00AA" "00AK" "00AL" ...
## $ home_link : chr "" "" "" "" ...
## $ wikipedia_link : chr "" "" "" "" ...
## $ keywords : chr "" "" "" "" ...
# plot airports by location (iso_country)
ggplot()+
geom_map(
data = world, map = world,
aes(long, lat, map_id = region),
color = "blue", fill = "white", size = 0.01)+
geom_point(
data = airports,
aes(longitude_deg, latitude_deg, color = iso_country),
alpha = .02) +
theme(legend.position="none")
## Warning: Ignoring unknown aesthetics: x, y
The map shows the distribution of airport and heliport locations by region within each country.