
Read the Natural Earth glaciated-areas ice layer
Source:R/polycell_layers.R
read_glaciated_areas.RdReads ne_10m_glaciated_areas, the ice source for
build_polycell_support(). A few features are invalid under the spherical
s2 engine and GEOS-level sf::st_make_valid() does not repair them, so
sf::st_area() aborts with "Loop 0 is not valid". Those features are
repaired under the planar engine, and any that remain invalid are measured
with terra::expanse(), which does not go through s2, and reported rather
than silently dropped.
The layer is a coarse present-day snapshot, so ice area does not vary historically. That is acceptable only while ice is a reporting category rather than a driver.
Value
An sf table of glaciated polygons in WGS84, carrying a
s2_repaired logical column. The "unrepaired" attribute is a tibble of
the features that stayed s2-invalid, with their terra::expanse() area.
Examples
# Requires WHEP_NATURALEARTH_DIR to be set; not run without it.
if (nzchar(Sys.getenv("WHEP_NATURALEARTH_DIR"))) {
read_glaciated_areas()
}