| ddbs_crs | R Documentation |
This is an S3 generic that extracts CRS information from various spatial objects.
ddbs_crs(x, ...)
## S3 method for class 'duckspatial_df'
ddbs_crs(x, ...)
## S3 method for class 'sf'
ddbs_crs(x, ...)
## S3 method for class 'tbl_duckdb_connection'
ddbs_crs(x, ...)
## S3 method for class 'character'
ddbs_crs(x, conn, ...)
## S3 method for class 'duckdb_connection'
ddbs_crs(x, name, ...)
## S3 method for class 'numeric'
ddbs_crs(x, ...)
## S3 method for class 'crs'
ddbs_crs(x, ...)
## S3 method for class 'data.frame'
ddbs_crs(x, ...)
## Default S3 method:
ddbs_crs(x, ...)
x |
An object containing spatial data. Can be:
|
... |
Additional arguments passed to methods |
conn |
A DuckDB connection (required for character method) |
name |
Table name (for backward compatibility when first arg is connection) |
CRS object from sf package
## Not run:
## load packages
library(duckdb)
library(duckspatial)
library(sf)
# Method 1: duckspatial_df objects
nc <- ddbs_open_dataset(system.file("shape/nc.shp", package = "sf"))
ddbs_crs(nc)
# Method 2: sf objects
nc_sf <- st_read(system.file("shape/nc.shp", package = "sf"))
ddbs_crs(nc_sf)
# Method 3: table name in database
conn <- ddbs_create_conn(dbdir = "memory")
ddbs_write_table(conn, nc_sf, "nc_table")
ddbs_crs(conn, "nc_table")
ddbs_stop_conn(conn)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.