Skip to content

Instantly share code, notes, and snippets.

@mthh
Created June 19, 2025 14:31
Show Gist options
  • Select an option

  • Save mthh/540e8fd11b92a825c3b00bf8bcc396bb to your computer and use it in GitHub Desktop.

Select an option

Save mthh/540e8fd11b92a825c3b00bf8bcc396bb to your computer and use it in GitHub Desktop.
Antarctic-centered Peirce Quincuncial projection
library(sf)
library(mapsf)
countries <- st_read('/vsizip/./ne_110m_admin_0_countries.zip')
peirce_south <- "+proj=ob_tran +o_proj=peirce_q +o_lat_p=-90 +o_lon_p=-250 +lon_0=0 +shape=square"
c <- st_transform(countries, peirce_south)
bb <- st_bbox(c)
xrange <- bb$xmax - bb$xmin
yrange <- bb$ymax - bb$ymin
bb_cut <- st_bbox(c(
bb$xmin + 0.008 * xrange,
bb$xmax - 0.008 * xrange,
bb$ymin + 0.008 * yrange,
bb$ymax - 0.008 * yrange
),
crs = peirce_south
)
cut_polygon <- st_as_sfc(bb_cut)
wc <- st_intersection(st_buffer(c, 0), cut_polygon)
mf_map(wc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment