as_sf_atlas: Rehydrate a ggseg atlas into sf-backed form

View source: R/atlas_polygon_converters.R

as_sf_atlasR Documentation

Rehydrate a ggseg atlas into sf-backed form

Description

Inverse of as_polygon_atlas(). Sets the single geom slot to an sf-class geometry table, converting from polygons via sfheaders::sf_multipolygon() if needed — sfheaders is pure Rcpp with no GDAL/GEOS/PROJ dependencies, so the conversion itself does not require a full sf installation. Use this when you want to run sf operations (buffers, intersections, CRS transforms) on atlas geometry; those sf operations themselves still require sf.

Usage

as_sf_atlas(atlas)

Arguments

atlas

A ggseg_atlas (or legacy brain_atlas) object.

Details

Conversion is lossless, so a single representation is kept (no redundant polygons alongside sf).

Value

A ggseg_atlas whose ⁠$data$geom⁠ is an sf object.

Examples

## Not run: 
library(sf)
atlas <- as_sf_atlas(as_polygon_atlas(dk()))
st_buffer(atlas_geom(atlas)$geometry[[1]], dist = 2)

## End(Not run)

ggseg.formats documentation built on July 2, 2026, 5:07 p.m.