Reads a DuckDB table containing geometry columns into an sf object.
Handles the ST_AsWKB() conversion required by DuckDB Spatial automatically.
cc_read_sf(con, table_name, geom_col = NULL, crs = 4326)DuckDB connection
Name of the table to read
Name of the geometry column (default: "geom"). If NULL, auto-detects the first GEOMETRY column.
Coordinate reference system to set (default: 4326 for WGS84). DuckDB Spatial does not store CRS metadata, so this must be specified.
An sf object with geometry column
if (FALSE) { # \dontrun{
con <- cc_get_db()
# read site points
sites_sf <- cc_read_sf(con, "site")
# read with specific geometry column
grid_sf <- cc_read_sf(con, "grid", geom_col = "geom_ctr")
# read with different CRS
sites_sf <- cc_read_sf(con, "site", crs = 4326)
} # }