Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active January 14, 2025 16:47
Show Gist options
  • Save mdsumner/e4aeca2b1aaf8282491b251c869dde22 to your computer and use it in GitHub Desktop.
Save mdsumner/e4aeca2b1aaf8282491b251c869dde22 to your computer and use it in GitHub Desktop.

R code for copying this cool toot: https://en.osm.town/@koriander/113459280926992782

src <- "/vsizip//vsicurl/https://github.com/wmgeolab/geoBoundaries/raw/main/releaseData/CGAZ/geoBoundariesCGAZ_ADM0.zip"
sql <- "SELECT shapeGroup FROM geoBoundariesCGAZ_ADM0 WHERE shapeGroup IN ('ATA')"
library(terra)
laea <- project(vect(src), "+proj=laea +lat_0=90")

ant <- project(vect(src, query = sql), "+proj=laea +lat_0=-90")
sc <- 7e6
png(width = 1024, height = 1024)
par(mar = rep(0, 4), bg = "black")
plot(laea, xlim = c(-1, 1) * sc, ylim = c(-1, 1) * sc, axes = FALSE, col = "lightgrey")
plot(terra::graticule(lon = seq(-180, 180, by = 30), 
                      lat = seq(0, 75, by = 15), crs = crs(laea)), add = TRUE, col = "white")

plot(shift(flip(ant, "horizontal"), dx = xmax(ant) - xmin(ant)), add = TRUE, col = scales::alpha("green", 0.3))

dev.off()



doesn't look as good and is very slow, we could speed this up ...

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment