Created
November 20, 2022 00:15
-
-
Save dakvid/e2b36105a545c7350c0568e289609c2d to your computer and use it in GitHub Desktop.
#30DayMapChallenge 2022 - Day 4 - Green
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tanaka map of Wellington Region elevation | |
# Adapting https://github.com/nrennie/30DayMapChallenge/blob/main/2022/scripts/18_blue.R | |
library(dplyr) | |
library(sf) | |
library(tanaka) | |
library(elevatr) | |
library(terra) | |
library(PrettyCols) | |
# https://datafinder.stats.govt.nz | |
wellington <- | |
st_read("regional-council-2021-clipped-generalised.gpkg") |> | |
filter(REGC2021_V1_00_NAME == "Wellington Region") |> | |
select(geom) |> | |
st_transform(crs = 4326L) | |
wellington_elev <- | |
get_elev_raster(wellington, | |
z = 10, | |
clip = "location") |> | |
rast() | |
png("Day_04_Green/day_04_green_tanaka.png", width = 8, height = 6, units = "in", res = 300) | |
par(mar = c(2, 2, 2, 2)) | |
tanaka(wellington_elev, | |
col = PrettyCols::prettycols("Greens", n = 8, type = "continuous"), | |
legend.pos = "n") | |
dev.off() | |
kapiti <- | |
st_read("territorial-authority-2021-clipped-generalised.gpkg") |> | |
filter(TA2021_V1_00_NAME == "Kapiti Coast District") |> | |
select(geom) |> | |
st_transform(crs = 4326L) | |
kapiti_elev <- | |
get_elev_raster(kapiti, z = 10, clip = "location") |> | |
rast() | |
png("Day_04_Green/day_04_bonus_kapiti.png", width = 8, height = 6, units = "in", res = 300) | |
par(mar = c(2, 2, 2, 2)) | |
tanaka(kapiti_elev, | |
col = PrettyCols::prettycols("Greens", n = 8, type = "continuous"), | |
legend.pos = "n") | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment