Skip to content

Instantly share code, notes, and snippets.

@dakvid
dakvid / day_14_hexagon_eckert.R
Created November 14, 2022 10:42
#30DayMapChallenge 2022 - Day 14 - Hexagon
# For #30DayMapChallenge 2022 Day 14 Hexagon
# Make an Eckert II projected world map, copying the idea from
# https://twitter.com/abiyugiday/status/1592065754903744513
library(sp)
library(sf)
library(rnaturalearth)
library(maptools)
library(ggplot2)
library(ragg)
@dakvid
dakvid / day_12_scale.R
Created November 13, 2022 09:31
#30DayMapChallenge 2022 - Day 12 - Scale
# #30DayMapChallenge 2022 - Day 12 - Scale
# Animate comparisons between NZ and other countries
# I'm not fully confident that the reprojection/translation approach is
# 100% accurate, but that's the fun of the challenges :-)
library(glue)
library(sf)
library(dplyr)
library(rnaturalearth)
@dakvid
dakvid / day_11_red_rata_streets.R
Last active November 14, 2022 10:59
#30DayMapChallenge 2022 - Day 11 - Red
# Animate views of all the Rata Streets across New Zealand
library(magrittr)
library(glue)
library(dplyr)
library(stringr)
library(purrr)
library(sf)
library(rmapshaper)
library(ggplot2)
@dakvid
dakvid / day_16_minimal.R
Created November 12, 2022 07:47
#30DayMapChallenge 2022 - Day 16 - Minimal
# #30DayMapChallenge 2022 | Day 16 | Minimal
# Inspired by https://twitter.com/benhur07b/status/1590124042245181440
# -- David Friggens, November 2022
library(readr)
library(sf)
library(dplyr)
library(stringr)
library(tidyr)
library(purrr)
@dakvid
dakvid / topogram_test.R
Created November 12, 2022 05:04
#30DayMapChallenge 2022 - Day 13 - 5 minute
# A simple test of the topogram package's functionality
# Mostly copying the tutorial https://dreamrs.github.io/topogram/articles/topogram.html
library(readr)
library(dplyr)
library(sf)
library(rmapshaper)
library(topogram)
library(Manu)
@dakvid
dakvid / day_10_bad_map.R
Created November 9, 2022 09:53
#30DayMapChallenge - Day 10 - A Bad Map
#30DayMapChallenge 2022 - Day 10 - A Bad Map
# The core idea is to label colour-named seas with the wrong colours.
# Extra levels of badness roled out as I started making it -
# "once you flop you can't stop!"
library(sf)
library(dplyr)
library(rnaturalearth)
@dakvid
dakvid / day_09_space.R
Created November 9, 2022 07:48
#30DayMapChallenge 2022 - Day 09 - Space
# For #30DayMapChallenge 2022 - Day 09 - Space
# Liberally borrowing from https://github.com/gkaramanis/30DayMapChallenge/tree/main/2022/07-raster
# -- David Friggens, November 2022
library(raster)
# Note: raster version 3.5-29 works and 3.6-2 somehow explodes everything :-/
library(marmap)
library(tidyterra)
library(sf)
library(ggplot2)
@dakvid
dakvid / wellington_road_elevation.R
Created November 7, 2022 18:08
#30DayMapChallenge 2022 - Day 08 - OpenStreetMap
# A map of Wellington streets coloured by elevation, adapting from
# https://github.com/BlakeRMills/30DayMapChallenge/tree/main/Day%2021%20(Elevation)/City%20Maps
# Made for #30DayMapChallenge 2022 - Day 08 - OpenStreetMap
# (My OSM access was acting up, but most of the NZ street data there comes from
# LINZ anyway, so may as well go straight to the horse's mouth)
# -- David Friggens, November 2022
library(elevatr)
library(raster)
library(dplyr)
@dakvid
dakvid / pacific_network.R
Last active November 6, 2022 03:16
#30DayMapChallenge 2022 - Day 06 - Networks
# Map of South Pacific islands, drawing a line from each to the nearest larger island
# David Friggens, November 2022
# Adapting https://gist.github.com/dakvid/982a017f46556806e33fd3b520877ce2
library(dplyr)
library(tidyr)
library(sf)
library(ggplot2)
library(sysfonts)
@dakvid
dakvid / the_polygons.R
Created November 5, 2022 07:50
#30DayMapChallenge 2022 - Day 03 - Polygons
library(dplyr)
library(sf)
library(ggplot2)
library(patchwork)
library(sysfonts)
library(showtext)
showtext_auto()
library(ragg)
# Read data --------------------------------------------------------------