% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/io_open_dataset.R
\name{ddbs_open_dataset}
\alias{ddbs_open_dataset}
\title{Open spatial dataset lazily via DuckDB}
\usage{
ddbs_open_dataset(
  path,
  crs = NULL,
  layer = NULL,
  geom_col = NULL,
  conn = NULL,
  parquet_binary_as_string = NULL,
  parquet_file_row_number = NULL,
  parquet_filename = NULL,
  parquet_hive_partitioning = NULL,
  parquet_union_by_name = NULL,
  parquet_encryption_config = NULL,
  read_shp_mode = c("ST_ReadSHP", "GDAL"),
  read_osm_mode = c("GDAL", "ST_ReadOSM"),
  shp_encoding = NULL,
  gdal_spatial_filter = NULL,
  gdal_spatial_filter_box = NULL,
  gdal_keep_wkb = NULL,
  gdal_max_batch_size = NULL,
  gdal_sequential_layer_scan = NULL,
  gdal_sibling_files = NULL,
  gdal_allowed_drivers = NULL,
  gdal_open_options = NULL
)
}
\arguments{
\item{path}{Path to spatial file. Supports Parquet (\code{.parquet}, with optional GeoParquet metadata),
GeoJSON, GeoPackage, Shapefile, FlatGeoBuf, OSM PBF, DuckDB database files
(\code{.duckdb}, \code{.db}, and \code{.ddb}), and other GDAL-supported formats.}

\item{crs}{Coordinate reference system. Can be an EPSG code (e.g., 4326),
a CRS string, or an \code{sf} crs object. If \code{NULL} (default),
attempts to auto-detect from the file, including native DuckDB CRS metadata
and duckspatial-managed column-comment metadata for compatibility
\code{.duckdb} files.}

\item{layer}{Layer name or index to read (ST_Read). For DuckDB database
files, this is required and specifies the table name to read. Default is
NULL (first layer for ST_Read).}

\item{geom_col}{Name of the geometry column. Default is \code{NULL}, which attempts
auto-detection.}

\item{conn}{DuckDB connection to use. If NULL, uses the default connection.}

\item{parquet_binary_as_string}{Logical. (Parquet) If TRUE, load binary columns as strings.}

\item{parquet_file_row_number}{Logical. (Parquet) If TRUE, include a \code{file_row_number} column.}

\item{parquet_filename}{Logical. (Parquet) If TRUE, include a \code{filename} column.}

\item{parquet_hive_partitioning}{Logical. (Parquet) If TRUE, interpret path as Hive partitioned.}

\item{parquet_union_by_name}{Logical. (Parquet) If TRUE, unify columns by name.}

\item{parquet_encryption_config}{List/Struct. (Parquet) Encryption configuration (advanced).}

\item{read_shp_mode}{Mode for reading Shapefiles. "ST_ReadSHP" (default, fast native reader) or "GDAL" (ST_Read).}

\item{read_osm_mode}{Mode for reading OSM PBF files. "GDAL" (default, ST_Read) or "ST_ReadOSM" (fast native reader, no geometry).}

\item{shp_encoding}{Encoding for Shapefiles when using "ST_ReadSHP" (e.g., "UTF-8", "ISO-8859-1").}

\item{gdal_spatial_filter}{Optional WKB geometry (as raw vector or hex string) to filter spatially (ST_Read only).}

\item{gdal_spatial_filter_box}{Optional bounding box (as numeric vector \code{c(minx, miny, maxx, maxy)})
(ST_Read only).}

\item{gdal_keep_wkb}{Logical. If TRUE, return WKB blobs instead of GEOMETRY type (ST_Read only).}

\item{gdal_max_batch_size}{Integer. Maximum batch size for reading (ST_Read only).}

\item{gdal_sequential_layer_scan}{Logical. If TRUE, scan layers sequentially (ST_Read only).}

\item{gdal_sibling_files}{Character vector. List of sibling files (ST_Read only).}

\item{gdal_allowed_drivers}{Character vector. List of allowed GDAL drivers (ST_Read only).}

\item{gdal_open_options}{Character vector. Driver-specific open options (ST_Read only).}
}
\value{
A \code{duckspatial_df} object.
}
\description{
Reads spatial data directly from disk using DuckDB's spatial extension or
native Parquet reader, returning a \code{duckspatial_df} object for lazy processing.
}
\references{
This function is inspired by the dataset opening logic in the
\code{duckdbfs} package (\url{https://github.com/cboettig/duckdbfs}).
}
