Chap. 9 : NZ > ## ----08-mapping-6
Hi, I'm still very much a newbie to R but I love making maps and so I've been working through Chapter 9, and came up against a problem with replicating the nz_water (territorial limits) at geocompr/code/chapters /09-mapping.R
nz_water = st_union(nz) |> st_buffer(22200) |> st_cast(to = "LINESTRING") map_nz2 = map_nz1 + tm_shape(nz_water) + tm_lines()
I have searched the text to find where I can source the (nz) in st_union(nz) without sucess. Many thanks, Mark Pearson Toowoomba, Queensland, Australia
Can you tell us which lines of code you have run so far, what the output was, and what you were expecting?
The nz object comes from the spData package:
library(sf)
#> Linking to GEOS 3.13.0, GDAL 3.10.3, PROJ 9.6.2; sf_use_s2() is TRUE
library(spData)
plot(nz)

Created on 2025-09-01 with reprex v2.1.1