Lab-9: If you please sir…which way to the Secret Garden?

The Grammar of Maps

Spatial Data
Maps
Static
Interactive
Choropleth Maps
Bubble Plots
Cartograms
Author

Arvind V

Published

July 10, 2022

Modified

May 21, 2024

Alice asks the Catterpillar the Way

Alice asks the Catterpillar the Way

Slides and Tutorials

R Tutorial Slides Leaflet Tutorial MapviewTutorial

Setting up R Packages

library(tidyverse) # Our Everything package
# Geospatial Data from the Web
library(osmdata)
library(rnaturalearth)
library(rnaturalearthdata)
library(rnaturalearthhires)

# Spatial Vector Data Processing
library(sf)

# Plotting
library(tmap)
library(leaflet)
library(mapview)

Introduction

Choropleth Map

What does choropleth1 mean? And what kind of information could this map represent?

Bubble Map

What information could this map below represent?

What is there to not like about maps!!! Let us now look at the slides. Then we will understand how the R packages sf, tmap work to create maps, using data downloadable into R using osmdata, osmplotr and rnaturalearth.

We will learn to make static and interactive maps and to show off different kinds of data on them, data that have an inherently “spatial” spread or significance! sf + ggplot and tmap give us great static maps. Interactive maps we will make with leaflet and mapview; tmap is also capable of creating interactive maps.

Trade Routes? Populations? Street Crime hotspots? Theatre and Food districts and popular Restaurants? Literary Paris, London and Barcelona?

All possible !!

Embedded Tutorials

knitr::include_url("../../../../labs/r-labs/maps/gram-maps.qmd")
knitr::include_url("../../../../slides/r-slides/spatial/Spatial-Data-in-R.html")

References

  1. OSM Basic Maps Vignette

  2. Nikita Voevodin, R, Not the Best Practices

  3. Nico Hahn, Making Maps with R

  4. Emine Fidan, Interactive Maps in R

  5. Lovelace et al, Geocomputation in R

Back to top

Footnotes

  1. Etymology. From Ancient Greek χώρα (khṓra, “location”) + πλῆθος (plêthos, “a great number”) + English map. First proposed in 1938 by American geographer John Kirtland Wright to mean “quantity in area,” although maps of the type have been used since the early 19th century.↩︎