sf_as_dbplyr: Registeran sf object as a DuckDB virtual table
Description
A thin wrapper around duckdb::duckdb_register() that creates a virtual
table, then selects the geometry column to DuckDB.'s GEOMETRY type in the
returned dbplyr representation. Mostly useful for join and spatial
operations within DuckDB. No data is copied.
The name for the virtual table that is registered or unregistered
sf_obj
sf object to be registered to duckdb
geom_only
if TRUE, only the geometry column is registered. Always
FALSE for sfc or sfg objects
overwrite
Should an existing registration be overwritten?
...
additional arguments passed to duckdb_register
Details
Behind the scenes, this function creates an initial view (name_init) with
the geometry stored as text via sf::st_as_text. It then creates the view
name which replaces the geometry column with DuckDB's internal geometry
type.