0

I am trying to create a map of New Zealand in R (sf, ggplot2), that includes Chatham Island. I am accessing the online New Zealand map from Natural Earth. Online I can see the Chatham Islands on the map, but when I run it in R it is not there. I'm not sure what I need to change to be able to visualize Chatham Island as well as the north and south islands.

This is the script I have used:

theme_set(theme_bw())

newzealand <- ne_countries(country="new zealand", type="countries", scale = 'small', returnclass = "sf")

ggplot(data = newzealand) +
  geom_sf() +
  xlim(166, 179) +
  ylim(-48, -34)

North and South Island of New Zealand

enter image description here

enter image description here

6
  • Welcome to GIS SE. As a new user, please take the Tour. Unfortunately data questions are not a good fit for our Focused question/Best answer model. For open data requests, we recommend the Open Data exchange site.
    – Vince
    Commented Dec 20, 2023 at 2:15
  • 5
    The Chatham Islands are at about 176° 30′ 0″ W. Note west, not east. They're on the other side of the antimeridian to most of NZ, and your xlim excludes them out of the gate. Commented Dec 20, 2023 at 3:56
  • I have my xlim set as xlim(166, 179) + ylim(-48, -34) is this what I am changing and how should it look? I'm not sure if it is that simple because even if I open the xlim right up e.g. (xlim(166, 250) + ylim(-48, -34) the Chatham Islands are still not seen. Commented Dec 21, 2023 at 0:52
  • I have added how the (xlim(166, 250) map looks above Commented Dec 21, 2023 at 0:59
  • Xlim (166, 194) looks pretty good as far as the position of where Chatham Islands SHOULD be but it is still not visible...any ideas please gis.stackexchange.com/users/25417/alphabetasoup Commented Dec 21, 2023 at 1:03

1 Answer 1

5

First, the detail level of the query is too low to get the islands. Also, WGS 84 lat/long is not the recommended coordinate reference system for this case. Use an appropriate CRS for NZ:

newzealand <- ne_countries(country="new zealand", type="countries", scale = "large", returnclass = "SF")


ggplot(data = newzealand) +
  geom_sf() +
  coord_sf(crs = 2193)

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.