geocompr icon indicating copy to clipboard operation
geocompr copied to clipboard

Chap. 9 : NZ > ## ----08-mapping-6

Open markjaypearson opened this issue 3 months ago • 2 comments

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

markjaypearson avatar Aug 31 '25 22:08 markjaypearson

Can you tell us which lines of code you have run so far, what the output was, and what you were expecting?

Robinlovelace avatar Sep 01 '25 09:09 Robinlovelace

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

Nowosad avatar Sep 01 '25 09:09 Nowosad