Skip to content

Instantly share code, notes, and snippets.

@dakvid
dakvid / day_26_islands.R
Created December 1, 2022 10:15
#30DayMapChallenge 2022 | Day 26 | Islands
# Plonk the largest islands together on the page
# I was going to both make these to scale, and animate between them, but
# didn't have enough time up my sleeve.
library(glue)
library(dplyr)
library(sf)
library(rnaturalearth)
library(ggplot2)
library(patchwork)
@dakvid
dakvid / day_25_roughsf.R
Created December 1, 2022 10:13
#30DayMapChallenge 2022 | Day 25 | Two Colours
library(stringr)
library(dplyr)
library(sf)
library(rmapshaper)
library(roughsf)
# https://datafinder.stats.govt.nz
ta <-
st_read("2021/statsnz/territorial-authority-2021-clipped-generalised.gpkg") |>
filter(! TA2021_V1_00 %in% c("067", "999")) |>
@dakvid
dakvid / day_2_lines.R
Created December 1, 2022 10:11
#30DayMapChallenge 2022 - Day 02 - Lines
# Simple map of state highways
library(dplyr)
library(sf)
library(ggplot2)
library(sysfonts)
font_add_google("Tinos")
COL_FG <- "white"
COL_BG <- "black"
MAP_FONT <- "Tinos"
@dakvid
dakvid / day_28_grids_3d.R
Created November 27, 2022 17:52
#30DayMapChallenge 2022 - Day 28 - 3D
# Take https://gist.github.com/dakvid/3bc77f4d3c2da742113229ba11b5cc8b
# and make it 3d with rayshader
library(glue)
library(stringr)
library(dplyr)
library(sf)
library(rmapshaper)
library(ggplot2)
library(rayshader)
@dakvid
dakvid / day_19_globe.R
Created November 27, 2022 10:30
#30DayMapChallenge 2022 - Day 19 - Globe
# Animate an expanding buffer around land, with a "globe" view of the Pacific
library(glue)
library(stringr)
library(dplyr)
library(purrr)
library(sf)
library(rnaturalearth)
library(ggplot2)
library(av)
@dakvid
dakvid / day_27_nz_albums.R
Created November 27, 2022 04:57
#30DayMapChallenge 2022 - Day 27 - Music
# Take the geocoded album covers from Audioculture and plonk them on a map :-)
# Don't obviously see options to control the size of the images :-/
library(curl)
library(jsonlite)
library(stringr)
library(purrr)
library(dplyr)
library(sf)
library(rmapshaper)
@dakvid
dakvid / day_18.R
Created November 27, 2022 03:34
#30DayMapChallenge 2022 - Day 18 - Blue
# Take the full Kontur dataset (if the machine can handle it) and show only those
# that match where I live
library(dplyr)
library(sf)
library(ggplot2)
# https://data.humdata.org/dataset/kontur-population-dataset
kontur <-
st_read("kontur_population_20220630.gpkg")
@dakvid
dakvid / westeros_nz.R
Created November 27, 2022 03:20
#30DayMapChallenge 2022 - Day 24 - Fantasy
# Overlay New Zealand on a map of Westeros
library(dplyr)
library(sf)
library(rmapshaper)
library(ggplot2)
# https://www.cartographersguild.com/showthread.php?t=30472
locations <-
st_read("GoTRelease/locations.shp")
@dakvid
dakvid / day_21_grids.R
Created November 20, 2022 10:05
#30DayMapChallenge 2022 - Day 21 - Kontur Population Data
# Compare Kontur Population Grid against Stats NZ grids for Wellington City
# For #30DayMapChallenge 2022 - Day 21
library(dplyr)
library(sf)
library(rmapshaper)
library(ggplot2)
# Kontur data -----------------------------------
@dakvid
dakvid / day_4_tanaka.R
Created November 20, 2022 00:15
#30DayMapChallenge 2022 - Day 4 - Green
# 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)