Figure 4.5 Te Reo Māori toponyms in Aotearoa

figures
code
R

I made an alternative version of this map for some slides. It shows off the little-known multiplication by an affine transform matrix superpower that sf somewhat surprisingly admits (it felt like a cheat-code when I came across it here).

Code
library(sf)
library(tmap)
library(dplyr)

ang <- 40 * pi / 180
rotation <- matrix(c(cos(ang), -sin(ang), 
                     sin(ang),  cos(ang)), 2, 2, byrow = TRUE)

nz <- st_read("nz-2193.gpkg") %>%
  st_cast("POLYGON") %>%
  mutate(geom = geom * rotation)
Reading layer `nz-2193' from data source 
  `/Users/david/Documents/code/computing-geographically/chapters/chap4/nz-2193.gpkg' 
  using driver `GPKG'
Simple feature collection with 1 feature and 0 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 1089973 ymin: 4748123 xmax: 2089535 ymax: 6194308
Projected CRS: NZGD2000 / New Zealand Transverse Mercator 2000
Code
toponyms <- st_read("placenames.gpkg") %>%
  mutate(maori = reo > 0) %>%
  mutate(geom = geom * rotation) %>%
st_filter(nz)
Reading layer `placenames' from data source 
  `/Users/david/Documents/code/computing-geographically/chapters/chap4/placenames.gpkg' 
  using driver `GPKG'
Simple feature collection with 47417 features and 9 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: 502051.1 ymin: 4460560 xmax: 2239532 ymax: 6638458
Projected CRS: NZGD2000 / New Zealand Transverse Mercator 2000
Code
tm_shape(nz) + 
  tm_fill(col = "#eee8d5") + 
  tm_shape(toponyms %>% arrange(id)) +
  tm_dots(col = "maori", palette = c("slategrey", "red"), size = 0.005, alpha = 0.2,
          legend.show = FALSE) +
  tm_layout(frame = FALSE, inner.margins = 0.05, bg.color = "#002b36")

As noted in the book, the materials for this figure draw on the amazing work of Chris McDowall and Tim Denee in their We Are Here atlas, the Toitū Te Whenua – Land Information New Zealand gazetteer of placenames, and on Te Hiku Media’s Ngā-kupu tools.

Code
# License (MIT)
#
# Copyright (c) 2023 David O'Sullivan
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to  permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

© 2023 David O’Sullivan