31 Day 29: Experimental

31.1 Data Source: GIS of Thrones

library(sf)
library(ggimage)
library(ggspatial)
library(tidyverse)
# https://blog.gvsig.org/2016/05/24/gis-of-thrones-mapping-game-of-thrones-with-gvsig/
# http://downloads.gvsig.org/download/documents/books/GISofThrones.zip

cont <- st_read("data/GISofThrones/GoTRelease/Continents.shp")
## Reading layer `Continents' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Continents.shp' using driver `ESRI Shapefile'
## Simple feature collection with 3 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: 0.9011003 ymin: -42.00216 xmax: 91.99359 ymax: 49.10222
## epsg (SRID):    NA
## proj4string:    NA
islands <- st_read("data/GISofThrones/GoTRelease/Islands.shp")
## Reading layer `Islands' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Islands.shp' using driver `ESRI Shapefile'
## Simple feature collection with 86 features and 3 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 5.433233 ymin: -36.04357 xmax: 67.70794 ymax: 37.58262
## epsg (SRID):    NA
## proj4string:    NA
regions <- st_read("data/GISofThrones/GoTRelease/Regions.shp")
## Reading layer `Regions' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Regions.shp' using driver `ESRI Shapefile'
## Simple feature collection with 56 features and 4 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -0.2051206 ymin: -41.63816 xmax: 92.98472 ymax: 49.23767
## epsg (SRID):    NA
## proj4string:    NA
polit <- st_read("data/GISofThrones/GoTRelease/Political.shp")
## Reading layer `Political' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Political.shp' using driver `ESRI Shapefile'
## Simple feature collection with 12 features and 3 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 0.9011003 ymin: -11.40838 xmax: 26.29015 ymax: 49.10222
## epsg (SRID):    NA
## proj4string:    NA
land <- st_read("data/GISofThrones/GoTRelease/Land.shp")
## Reading layer `Land' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Land.shp' using driver `ESRI Shapefile'
## Simple feature collection with 2 features and 2 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 0.9011003 ymin: -42.00216 xmax: 91.99359 ymax: 49.10222
## epsg (SRID):    NA
## proj4string:    NA
landsc <- st_read("data/GISofThrones/GoTRelease/Landscape.shp")
## Reading layer `Landscape' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Landscape.shp' using driver `ESRI Shapefile'
## Simple feature collection with 37 features and 5 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 5.942558 ymin: -41.92678 xmax: 91.91442 ymax: 47.14478
## epsg (SRID):    NA
## proj4string:    NA
riv <- st_read("data/GISofThrones/GoTRelease/Rivers.shp")
## Reading layer `Rivers' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Rivers.shp' using driver `ESRI Shapefile'
## Simple feature collection with 74 features and 4 fields
## geometry type:  MULTILINESTRING
## dimension:      XY
## bbox:           xmin: 6.054601 ymin: -36.23881 xmax: 78.73064 ymax: 42.82271
## epsg (SRID):    NA
## proj4string:    NA
lak <- st_read("data/GISofThrones/GoTRelease/Lakes.shp")
## Reading layer `Lakes' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Lakes.shp' using driver `ESRI Shapefile'
## Simple feature collection with 19 features and 3 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: 8.288085 ymin: -16.38318 xmax: 85.85195 ymax: 45.10014
## epsg (SRID):    NA
## proj4string:    NA
wall <- st_read("data/GISofThrones/GoTRelease/Wall.shp")
## Reading layer `Wall' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Wall.shp' using driver `ESRI Shapefile'
## Simple feature collection with 1 feature and 2 fields
## geometry type:  LINESTRING
## dimension:      XY
## bbox:           xmin: 16.39357 ymin: 34.79226 xmax: 20.71819 ymax: 35.19238
## epsg (SRID):    NA
## proj4string:    NA
roads <- st_read("data/GISofThrones/GoTRelease/Roads.shp")
## Reading layer `Roads' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Roads.shp' using driver `ESRI Shapefile'
## Simple feature collection with 21 features and 4 fields
## geometry type:  LINESTRING
## dimension:      XY
## bbox:           xmin: 6.540938 ymin: -24.64828 xmax: 67.18459 ymax: 34.89038
## epsg (SRID):    NA
## proj4string:    NA
loc <- st_read("data/GISofThrones/GoTRelease/Locations.shp")
## Reading layer `Locations' from data source `/Users/hrbrmstr/books/30-day-map-challenge/data/GISofThrones/GoTRelease/Locations.shp' using driver `ESRI Shapefile'
## Simple feature collection with 247 features and 5 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 5.140883 ymin: -34.58818 xmax: 87.984 ymax: 37.21249
## epsg (SRID):    NA
## proj4string:    NA

sea_col <- "#39474e"
land_col <- "#bbc09c"
forest_col <- "#31382588"
mountain_col <- "#989a81"
stepp_col <- "#bec2a5"
swamp_col <- "#6e715c"
water_col <- "#425461"
road_col <- "black"
loc_col <- "#5d2210"

mutate(landsc, f_col = case_when(
  type == "forest" ~ forest_col,
  type == "mountain" ~ mountain_col,
  type == "stepp" ~ stepp_col,
  type == "swamp" ~ swamp_col
)) -> landsc

mutate(regions, r_col = case_when(
  name == "The Red Waste" ~ "#81432877",
  name == "The Land of Always Winter" ~ "#ffffff99",
  name == "The Disputed Lands" ~ "#c2af94",
  name == "The Flatlands" ~ "#c2af94",
  TRUE ~ "#00000000"
)) -> regions

mutate(islands, i_col = case_when(
  name == "Ibben" ~ "#ffffff99",
  TRUE ~ land_col
)) -> islands

mutate(loc, loc_sz = case_when(
  type == "Castle" ~ 1,
  type == "City" ~ 0.6,
  type == "Other" ~ 0.25,
  type == "Ruin" ~ 0.33,
  type == "Town" ~ 0.4
)) -> loc

31.2 Drawing the Map

Luminari65

ggplot() +
  geom_sf(data = land, fill = land_col, color = "#5f7f7f", size = 0.5) +
  geom_sf(data = islands, aes(fill = I(i_col)), color = "#5f7f7f", size = 0.5) +
  geom_sf(data = cont, fill = land_col, size = 0.125) +
  geom_sf(data = regions, aes(fill = r_col), color = NA, size = 0.125) +
  geom_sf(data = landsc, aes(fill = I(f_col)), size = 0.125) +
  geom_sf(data = lak, size = 0.125, color = water_col, fill = water_col) +
  geom_sf(data = riv, fill = NA, size = 0.125, color = water_col) +
  geom_sf(data = wall, fill = NA, size = 1, color = "white") +
  geom_sf(data = roads, fill = NA, size = 0.33, color = road_col) +
  geom_sf(data = loc, fill = NA, color = loc_col, aes(size = I(loc_sz))) +
  geom_sf_text(
    data = regions, aes(label = name),
    family = "Luminari", size = 2, color = "#b2b2b2"
  ) +
  geom_image(
    data = data.frame(),
    aes(x = 32, y = 41, image = "data/rose3.png"),
    size = 0.1
  ) +
  geom_text(
    data = data.frame(),
    aes(x = 70, y = 45, label = "A Song Of Ice and Fire"),
    family = "Luminari", size = 8, color = "white"
  ) +
  coord_sf(datum=NA) +
  labs(
    x = NULL, y = NULL,
    caption = "Data source: GISofThrones <downloads.gvsig.org/download/documents/books/> • #30DayMapChallenge"
  ) +
  theme(plot.caption = element_text(color = "white")) +
  theme(plot.background = element_rect(color=sea_col, fill=sea_col)) +
  theme(panel.background = element_rect(color=sea_col, fill=sea_col))

31.3 In Review

31.4 Try This At Home