% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ddbs_crs.R
\name{ddbs_crs}
\alias{ddbs_crs}
\alias{ddbs_crs.duckspatial_df}
\alias{ddbs_crs.sf}
\alias{ddbs_crs.tbl_duckdb_connection}
\alias{ddbs_crs.character}
\alias{ddbs_crs.duckdb_connection}
\alias{ddbs_crs.numeric}
\alias{ddbs_crs.crs}
\alias{ddbs_crs.data.frame}
\alias{ddbs_crs.default}
\title{Check CRS of spatial objects or database tables}
\usage{
ddbs_crs(x, ...)

\method{ddbs_crs}{duckspatial_df}(x, ...)

\method{ddbs_crs}{sf}(x, ...)

\method{ddbs_crs}{tbl_duckdb_connection}(x, ...)

\method{ddbs_crs}{character}(x, conn, ...)

\method{ddbs_crs}{duckdb_connection}(x, name, ...)

\method{ddbs_crs}{numeric}(x, ...)

\method{ddbs_crs}{crs}(x, ...)

\method{ddbs_crs}{data.frame}(x, ...)

\method{ddbs_crs}{default}(x, ...)
}
\arguments{
\item{x}{An object containing spatial data. Can be:
\itemize{
\item \code{duckspatial_df}: Lazy spatial data frame (CRS from attributes)
\item \code{sf}: sf object (CRS from sf metadata)
\item \code{character}: Name of table in database (requires \code{conn})
}}

\item{...}{Additional arguments passed to methods}

\item{conn}{A DuckDB connection (required for character method)}

\item{name}{Table name (for backward compatibility when first arg is connection)}
}
\value{
CRS object from \code{sf} package
}
\description{
This is an S3 generic that extracts CRS information from various spatial objects.
}
\examples{
\dontrun{
## 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)
}
}
