library(here)
library(tidyverse)
library(stars)
library(sf)
library(tmap)
Source Materials
The following materials are modified from the tmap book.
1. Learning Objectives
- Read in spatial objects
- Create map with single spatial object
- Create map with multiple spatial objects
- Use different types of
tmap
plotting formats (e.g.tm_polygons()
,tm_fill()
,tm_dots()
, etc.) - Adjust color palettes
- Include essential map elements (e.g. scale bar & north arrow or graticules)
- Create an interactive map
- Bonus Challenge: Reproduce map using
ggplot2
instead oftmap
More map making in R
There are MANY different ways to make maps in R, all with different pros/cons. Check out this resource for examples of what map making looks like in ggplot2
, leaflet
, and more!
2. Get Started
- Open your forked version of this repository and navigate to your version controlled project for Week 1
- Create a Quarto document
- Load all necessary packages
- Read in the spatial objects for Easter Island (Rapa Nui/Isla de Pascua):
ei_points
: file contains several points on the islandei_elev
: raster with elevation dataei_borders
: polygon with the island outlineei_roads
: lines contains a road network for the island
<- sf::read_sf(here::here("data", "easter_island", "ei_points.gpkg"))
ei_points <- subset(ei_points, type == "volcano")
volcanoes <- stars::read_stars(here::here("data", "easter_island", "ei_elev.tif"))
ei_elev <- sf::read_sf(here::here("data", "easter_island", "ei_border.gpkg"))
ei_borders <- sf::read_sf(here::here("data", "easter_island", "ei_roads.gpkg")) ei_roads
3. Your Task
Now, to meet this week’s learning objectives, your task:
- Create a map of Easter Island
- Create a map of Easter Island and…
- …denote the island’s borders and continuous elevation
- …denote the island’s volcanoes and roads
- …play with the color palette and essential map elements
- Create an interactive map of Easter Island