Loading web-font TeX/Math/Italic
Skip to main content

R: Mapping Super Typhoon Yolanda (Haiyan) Track

After reading Enrico Tonini post, I decided to map the super typhoon Haiyan track using OpenStreetMap, maptools, and ggplot2. If mapping with googleVis was possible with 13 lines only, that can also be achieved with the packages I used; but because I play with the aesthetic of the map, thus I got more than that. The data was taken from Weather Underground, and just to be consistent with the units from JMA Best Track Data, which I utilized for mapping typhoon Labuyo (Utor), the wind speed in miles per hour (mph) was converted to knots. So here is the final output,

Labels:
  • TD - Tropical Depression
  • TS - Tropical Storm
  • TY - Typhoon
  • STY - Super Typhoon
As for the super typhoon, please don't visit my country again. I would like to thank all who prayed for Philippines, especially for countries who helped us recover from this tragedy.

Codes:

The codes and data are also available on Github.

#Load the packages
library(ggplot2)
library(maptools)
library(OpenStreetMap)
gpclibPermit()
#Import the data
text <- download.file("https://raw.github.com/alstat/Analysis-with-Programming/master/2013/R/R-Mapping-Super-Typhoon-Yolanda-Haiyan-Track/TyDatYolanda2013.csv",
destfile = "/tmp/test.csv", method = "curl")
tydat <- read.csv("/tmp/test.csv", header = TRUE)
#Obtain the Map
map <- openmap(c(27.605671,103.256834),
c(1.757537,150.4541),
minNumTiles=4,type="mapquest-aerial",zoom = 6)
map <- openproj(map)
#Convert mph to knot
tydatMaxSpeed <- tydatMaxSpeed * 0.868976
#Plot the map with data points
p <- autoplot(map) +
geom_point(data = tydat,
aes(x = CLongitude,
y = CLatitude),
alpha = 0.5,
colour = "orange",
size = 2) +
geom_point(data = tydat,
aes(x = CLongitude,
y = CLatitude),
alpha = 0.3,
colour = "white",
size = tydat$MaxSpeed*0.4) +
geom_path(data = tydat,
aes(x = CLongitude,
y = CLatitude),
alpha = 0.7,
colour = "orange") +
geom_point(data = tydat,
aes(x = CLongitude,
y = CLatitude),
alpha = 0.5,
colour = "yellow",
size = tydat$MaxSpeed*0.25) +
geom_point(data = tydat,
aes(x = CLongitude,
y = CLatitude,
colour = MaxSpeed),
alpha = 0.6,
size = tydat$MaxSpeed*0.2) +
scale_colour_gradient(
name = "Wind Speed (Knot)",
low = "yellow",
high = "red") +
geom_text(data = tydat,
aes(x = CLongitude,
y = CLatitude,
label = Category,
family = "serif",
fontface = "bold"),
colour = "white",
size = rel(3.5)) +
labs(title = "Super Typhoon | Yolanda (Haiyan) | November 3 - 11, 2013") +
xlab(expression(bold("Longitude"))) +
ylab(expression(bold("Latitude"))) +
theme(panel.background = element_rect(
size = 3,
colour = "black",
fill = "white"),
axis.ticks = element_line(
size = 2),
axis.title.x = element_text(
size = rel(1.2),
face = "bold"),
axis.title.y = element_text(
size = rel(1.2),
face = "bold"),
plot.title = element_text(
size = 20,
face = "bold",
vjust = 1.5),
legend.position = "bottom",
legend.title = element_text(
size=rel(1.2),
face="bold")) +
coord_fixed()
p
view raw Yolanda.R hosted with ❤ by GitHub