Other sites

Map of Middle Earth in R

Map of Middle Earth

The map above was created using ggplot2, ggmaps, and maptools in R. These are just a few of the great R packages available for cartography and geographic applications. Many readers of this blog will be familiar with these packages and more recent R package additions like leaflet. But great packages are only part of the problem… geographic data about Middle earth is generally found on the inside cover of Tolkien books or perhaps in the Atlas of Middle Earth. And this “data” is just pictures.

Fortunately shapefiles are available in a Github Repo that represent many of the significant features of middle earth: https://github.com/jvangeld/ME-GIS. Thanks to the creators of these files (the Middle Earth DEM Project) for your work and generously making these files available online.

If you want to follow along with the R code that follows, clone this repo or download the files to your local machine and extract ’em.

The ggplot2 package is used to plot the map. The ggmap package includes the fortify() function which translates the shapefile data into a data frame and the maptools package is used to read the shape files.

Next, navigate to the directory containing the shapefiles and read in the data

setwd(‘/path/to/downloaded/ME-GIS/’)

Read in the data files using maptools.

coastline ->forests ->lakes ->rivers ->contours ->

Render the map. Each of the variables containing data is associated with a geom_polygon or geom_path function call.

So if you looking for a brief escape into a fantasy realm or hoping to inspire young imaginative cartographers, check out the data at github, load the shapefiles into R using maptools or the rgdal package and get plotting!