Data on a 3D world map using R

Mohit Singh
datascape
Published in
3 min readFeb 17, 2017

--

How United States Airports are connected to the rest of the World

Animation(GIF) to show how US Airports are connected to the world created using R

I wanted to create an interactive Globe that you can spin and able to show connections of US Airports to the rest of the World. I couldn’t integrate the output here, so decided to create an animation to show the behavior of the visualization.

How Airports in US are connected to the rest of the World — Visualization made in R

I used data from openflights.org and filter it to focus on the flight connections from US Airports to the rest of the world.

My First Attempt to make a 3D globe something like this, using rworldmap and geosphere libraries in R. But that was not interactive. Then, I came across WebGL and three.js and started to use them through R. And yeah I used the image from NASA to map on the globe.

library(rworldmap)
library(dplyr)
library(ggplot2)
library(geosphere)
library(gpclib)
library(rworldxtra)
dd <-data(countriesHigh)# World map
worldMap <- getMap(resolution = “high”)
world.points <- fortify(worldMap)
world.points$region <- world.points$idworld.df <- world.points[,c(“long”,”lat”,”group”, “region”)]
worldmap <- ggplot() +
geom_polygon(data = world.df, aes(x = long, y =…

--

--