| Title: | Modern GDAL Vector Data Workflows |
|---|---|
| Description: | Opinionated system for working with modern geospatial vector data formats using GDAL. |
| Authors: | Jimmy Briggs [aut, cre] (ORCID: <https://orcid.org/0000-0002-7489-8787>) |
| Maintainer: | Jimmy Briggs <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.3 |
| Built: | 2026-06-29 20:31:45 UTC |
| Source: | https://github.com/jimbrig/gdalvector |
Render a gdal_config_opts() or gdal_vsi_opts() object to a named character vector
c(NAME = "VALUE"), the form consumed by gdalraster::set_config_option(). Configuration
options are ignored by the GDAL algorithm API and must be applied to the process/session this
way (or via the CLI --config flag, see as_gdal_args()).
as_config_option(x, ...) ## S3 method for class 'gdal_config_opts' as_config_option(x, ...) ## S3 method for class 'gdal_vsi_opts' as_config_option(x, ...) ## Default S3 method: as_config_option(x, ...)as_config_option(x, ...) ## S3 method for class 'gdal_config_opts' as_config_option(x, ...) ## S3 method for class 'gdal_vsi_opts' as_config_option(x, ...) ## Default S3 method: as_config_option(x, ...)
x |
A |
... |
Passed to methods. |
A named character vector.
as_config_option(gdal_config_opts(CPL_DEBUG = "ON"))as_config_option(gdal_config_opts(CPL_DEBUG = "ON"))
Render a gdal_opts() object to the form consumed by the GDAL algorithm API
(gdalraster::gdal_alg() / gdalraster::gdal_run()).
as_gdal_args(x, ...) ## S3 method for class 'gdal_opts' as_gdal_args(x, cli = TRUE, long = FALSE, with_format = FALSE, ...) ## S3 method for class 'character' as_gdal_args(x, ...) ## S3 method for class 'list' as_gdal_args(x, ...) ## Default S3 method: as_gdal_args(x, ...)as_gdal_args(x, ...) ## S3 method for class 'gdal_opts' as_gdal_args(x, cli = TRUE, long = FALSE, with_format = FALSE, ...) ## S3 method for class 'character' as_gdal_args(x, ...) ## S3 method for class 'list' as_gdal_args(x, ...) ## Default S3 method: as_gdal_args(x, ...)
x |
A |
... |
Passed to methods. |
cli |
Logical; emit interleaved CLI tokens ( |
long |
Logical; use long flag names ( |
with_format |
Logical; prepend the |
For repeated options (--oo/--co/--lco), GDAL requires each value to be preceded by its own
flag - values are never comma-packed (a packed value would corrupt options such as
PRELUDE_STATEMENTS that themselves contain ;/,). Accordingly:
cli = TRUE (default) emits a flat token vector c("--open-option", "K=V", "--open-option", "K2=V2", ...), suitable as the args to gdalraster::gdal_alg().
cli = FALSE emits an unnamed c("K=V", ...) vector, suitable for a single
alg$setArg(<flag>, .) call.
A character vector.
as_gdal_args(gdal_open_opts(LIST_ALL_TABLES = FALSE, driver = "GPKG")) as_gdal_args(gdal_open_opts(LIST_ALL_TABLES = FALSE), cli = FALSE)as_gdal_args(gdal_open_opts(LIST_ALL_TABLES = FALSE, driver = "GPKG")) as_gdal_args(gdal_open_opts(LIST_ALL_TABLES = FALSE), cli = FALSE)
Coerce a named list, a KEY=VALUE character vector, a driver-metadata tibble, or an existing
gdal_config_opts to the gdal_config_opts() class.
as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## Default S3 method: as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'gdal_config_opts' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'list' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'character' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'tbl_df' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env())as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## Default S3 method: as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'gdal_config_opts' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'list' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'character' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'tbl_df' as_gdal_config_opts(x, ..., driver = NULL, call = rlang::caller_env())
x |
Object to coerce. |
... |
Unused; for method extensibility. |
driver |
Optional GDAL driver short name to attach. |
call |
The execution environment of a currently
running function, e.g. |
A gdal_config_opts() object.
Coerce a named list, a KEY=VALUE character vector, a driver-metadata tibble, or an existing
gdal_creation_opts to the gdal_creation_opts() class.
as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## Default S3 method: as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'gdal_creation_opts' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'list' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'character' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'tbl_df' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() )as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## Default S3 method: as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'gdal_creation_opts' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'list' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'character' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() ) ## S3 method for class 'tbl_df' as_gdal_creation_opts( x, ..., driver = NULL, level = c("layer", "dataset"), call = rlang::caller_env() )
x |
Object to coerce. |
... |
Unused; for method extensibility. |
driver |
Optional GDAL driver short name to attach. |
level |
Creation-option level: |
call |
The execution environment of a currently
running function, e.g. |
A gdal_creation_opts() object.
Coerce a named list, a KEY=VALUE character vector, a driver-metadata tibble, or an existing
gdal_open_opts to the gdal_open_opts() class.
as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## Default S3 method: as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'gdal_open_opts' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'list' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'character' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'tbl_df' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env())as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## Default S3 method: as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'gdal_open_opts' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'list' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'character' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env()) ## S3 method for class 'tbl_df' as_gdal_open_opts(x, ..., driver = NULL, call = rlang::caller_env())
x |
Object to coerce. |
... |
Unused; for method extensibility. |
driver |
Optional GDAL driver short name to attach. |
call |
The execution environment of a currently
running function, e.g. |
A gdal_open_opts() object.
Coerce a named list, a KEY=VALUE character vector, or an existing gdal_vsi_opts to the
gdal_vsi_opts() class. VSI options are path-scoped, config-like settings applied via
gdalraster::vsi_set_path_option().
as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## Default S3 method: as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## S3 method for class 'gdal_vsi_opts' as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## S3 method for class 'list' as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## S3 method for class 'character' as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env())as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## Default S3 method: as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## S3 method for class 'gdal_vsi_opts' as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## S3 method for class 'list' as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env()) ## S3 method for class 'character' as_gdal_vsi_opts(x, ..., vsi_path = NULL, call = rlang::caller_env())
x |
Object to coerce. |
... |
Unused; for method extensibility. |
vsi_path |
Optional VSI path prefix the options apply to (e.g. |
call |
The execution environment of a currently
running function, e.g. |
A gdal_vsi_opts() object.
Coerce to GDALG
as_gdalg(x, ..., call = rlang::caller_env())as_gdalg(x, ..., call = rlang::caller_env())
x |
An object to coerce to class |
... |
Additional arguments passed to specific methods. |
call |
The calling environment, used for error messages. |
An object of class "gdalg".
Checks that the provided value x (in bytes) does not exceed the available system RAM as returned by
sys_available_ram(). If the check fails, an error is thrown.
check_available_ram(x, arg = rlang::caller_arg(x), call = rlang::caller_env())check_available_ram(x, arg = rlang::caller_arg(x), call = rlang::caller_env())
x |
The object to check. |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
If the check passes, invisibly returns the provided x value. If the check fails, a condition error is thrown
indicating that the provided value exceeds available system RAM.
These functions perform checks that assert the underlying class of objects passed to them.
check_inherits(): checks that object x is of class class using base::inherits()
check_inherits2(): checks that object x is of class class using base::.class2()
check_inherits_any(): checks that object x is at least one of the provided classes via rlang::inherits_any()
check_inherits_all(): checks that object x is all of the provided classes via rlang::inherits_all()
If validation fails for any of these functions, an error is thrown via check_abort() displaying a friendly
error message.
check_inherits( x, class, arg = rlang::caller_arg(x), call = rlang::caller_env() ) check_inherits2( x, class, arg = rlang::caller_arg(x), call = rlang::caller_env() ) check_inherits_any( x, classes, arg = rlang::caller_arg(x), call = rlang::caller_env() ) check_inherits_all( x, classes, arg = rlang::caller_arg(x), call = rlang::caller_env() )check_inherits( x, class, arg = rlang::caller_arg(x), call = rlang::caller_env() ) check_inherits2( x, class, arg = rlang::caller_arg(x), call = rlang::caller_env() ) check_inherits_any( x, classes, arg = rlang::caller_arg(x), call = rlang::caller_env() ) check_inherits_all( x, classes, arg = rlang::caller_arg(x), call = rlang::caller_env() )
x |
The object to check. |
class, classes
|
The name of the class or classes to use during checking. |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
If checks pass, invisibly returns the provided x object. If checks fail, a condition error is thrown.
Checks the provided x is not "empty" via rlang::is_empty().
check_not_empty(x, arg = rlang::caller_arg(x), call = rlang::caller_env())check_not_empty(x, arg = rlang::caller_arg(x), call = rlang::caller_env())
x |
The object to check. |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
If checks pass, invisibly returns the provided x object. If checks fail, a condition error is thrown.
Checks the provided x is a scalar string via rlang::check_string().
check_string(x, arg = rlang::caller_arg(x), call = rlang::caller_env())check_string(x, arg = rlang::caller_arg(x), call = rlang::caller_env())
x |
The object to check. |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
If checks pass, invisibly returns the provided x object. If checks fail, a condition error is thrown.
Collection of various checking functions primarily used for incorporating argument validation checks for package functions.
These check functions act as assertions, and will either return the provided objects invisibly, or throw exceptions.
The FlatGeobuf driver exposes no documented configuration options. This constructor exists for
interface symmetry with the other driver option families; it warns and returns an empty
gdal_config_opts() object.
fgb_config_opts(...)fgb_config_opts(...)
... |
Ignored (no configuration options are available for this driver). |
An (empty) gdal_config_opts() object for the FlatGeobuf driver.
fgb_open_opts(), fgb_creation_opts()
fgb_config_opts()fgb_config_opts()
Construct a layer-level gdal_creation_opts() object for the FlatGeobuf driver. Only options
you supply are emitted; values are validated against the driver's registered metadata.
fgb_creation_opts( spatial_index = NULL, temporary_dir = NULL, title = NULL, description = NULL, ..., .set_defaults = FALSE )fgb_creation_opts( spatial_index = NULL, temporary_dir = NULL, title = NULL, description = NULL, ..., .set_defaults = FALSE )
spatial_index |
Value for |
temporary_dir |
Value for |
title |
Value for |
description |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A layer-level gdal_creation_opts() object for the FlatGeobuf driver.
fgb_open_opts(), gdal_creation_opts()
fgb_creation_opts(spatial_index = TRUE, title = "Parcels")fgb_creation_opts(spatial_index = TRUE, title = "Parcels")
Construct a gdal_open_opts() object for the FlatGeobuf driver. Only options you supply are
emitted; values are validated against the driver's registered metadata.
fgb_open_opts(verify_buffers = NULL, ..., .set_defaults = FALSE)fgb_open_opts(verify_buffers = NULL, ..., .set_defaults = FALSE)
verify_buffers |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_open_opts() object for the FlatGeobuf driver.
fgb_creation_opts(), gdal_open_opts()
fgb_open_opts() fgb_open_opts(verify_buffers = FALSE) fgb_open_opts(.set_defaults = TRUE)fgb_open_opts() fgb_open_opts(verify_buffers = FALSE) fgb_open_opts(.set_defaults = TRUE)
Validates if the available RAM is sufficient to build a spatial index for a FlatGeobuf file based on the number of features and an estimated RAM requirement of 83 bytes per feature.
fgb_validate_spatial_index_ram(fgb_dsn, force = FALSE, quiet = FALSE)fgb_validate_spatial_index_ram(fgb_dsn, force = FALSE, quiet = FALSE)
fgb_dsn |
The data source name (DSN) of the FlatGeobuf file to validate. |
force |
Logical indicating whether to force the feature count (default: |
quiet |
Logical indicating whether to suppress success messages (default: |
Returns TRUE if sufficient RAM is available to build the spatial index, and FALSE otherwise.
Also provides informative messages about the RAM requirements and availability.
Creates a session-wide, global GDAL Configuration object of class "gdal_config".
gdal_config(...)gdal_config(...)
... |
Configuration options as named |
gdal_config
Links to the official GDAL Configuration Documentation.
Construct a gdal_config_opts() object from NAME = value pairs. Configuration options are
global, stateful settings applied to the GDAL process (via gdalraster::set_config_option() /
the CLI --config flag), and are not algorithm arguments. When driver is supplied, values
for boolean options are validated against the driver metadata.
gdal_config_opts(..., driver = NULL, .set_defaults = FALSE)gdal_config_opts(..., driver = NULL, .set_defaults = FALSE)
... |
Named configuration options as |
driver |
Optional GDAL driver short name (e.g. |
.set_defaults |
Logical. If |
A gdal_config_opts() object.
gdal_config_opts(CPL_DEBUG = "ON", GDAL_NUM_THREADS = "ALL_CPUS")gdal_config_opts(CPL_DEBUG = "ON", GDAL_NUM_THREADS = "ALL_CPUS")
Construct a gdal_creation_opts() object from NAME = value pairs. The level controls whether
these are dataset-creation options (--co) or layer-creation options (--lco, the default).
gdal_creation_opts( ..., driver = NULL, level = c("layer", "dataset"), .set_defaults = FALSE )gdal_creation_opts( ..., driver = NULL, level = c("layer", "dataset"), .set_defaults = FALSE )
... |
Named creation options ( |
driver |
Optional GDAL driver short name to associate. |
level |
Creation-option level, |
.set_defaults |
Logical. If |
A gdal_creation_opts() object.
gdal_creation_opts(COMPRESSION = "ZSTD", driver = "Parquet")gdal_creation_opts(COMPRESSION = "ZSTD", driver = "Parquet")
Query the GDAL drivers registered in the active GDAL build.
gdal_drivers(): returns a normalized tibble::tibble() of driver metadata (identity,
capabilities, supported extensions and SQL dialects), optionally filtered by a name pattern.
gdal_driver_names(): returns just the short driver names.
The driver table is built once from gdalraster::gdal_formats() and cached for the session.
gdal_drivers(pattern = NULL, ignore_case = TRUE) gdal_driver_names(pattern = NULL)gdal_drivers(pattern = NULL, ignore_case = TRUE) gdal_driver_names(pattern = NULL)
pattern |
Optional character vector of regular-expression patterns. Drivers whose short or
long name matches any pattern are returned. |
ignore_case |
Logical; match |
gdal_drivers(): a tibble::tibble() with one row per driver.
gdal_driver_names(): a character vector of short driver names.
gdal_vector_driver_opts(), gdal_vector_driver_capabilities()
gdal_drivers() gdal_drivers(c("parquet", "geojson")) gdal_driver_names("gpkg")gdal_drivers() gdal_drivers(c("parquet", "geojson")) gdal_driver_names("gpkg")
Construct a gdal_open_opts() object from NAME = value pairs (the GDAL --oo /
GDALOpenEx() open-option channel).
gdal_open_opts(..., driver = NULL, .set_defaults = FALSE)gdal_open_opts(..., driver = NULL, .set_defaults = FALSE)
... |
Named open options ( |
driver |
Optional GDAL driver short name to associate. |
.set_defaults |
Logical. If |
A gdal_open_opts() object.
gdal_open_opts(LIST_ALL_TABLES = FALSE, driver = "GPKG")gdal_open_opts(LIST_ALL_TABLES = FALSE, driver = "GPKG")
GDAL options control how the GDAL/OGR library reads, writes, and otherwise processes geospatial
data. This package models the distinct GDAL option channels as a small family of S3 classes,
each backed by a named list of NAME = "VALUE" pairs (values stored as their coerced GDAL
strings) plus a driver attribute, so a set of options is an inert, composable value that can be
rendered on demand to whichever form a given consumer needs.
In the GDAL CLI, an option is supplied via one of these argument flags:
--config <NAME>=<VALUE> --open-option / --oo <NAME>=<VALUE> --creation-option / --co <NAME>=<VALUE> --layer-creation-option / --lco <NAME>=<VALUE>
All four classes share the gdal_opts base (a named list) and differ only by channel:
gdal_opts |- gdal_config_opts --config CPLSetConfigOption() |- gdal_open_opts --oo GDALOpenEx() |- gdal_creation_opts (level = layer) --lco GDALDatasetCreateLayer() | (level = dataset) --co GDALCreate() |- gdal_vsi_opts (vsi_path) --config VSISetPathSpecificOption()
gdal_config_opts(): global, stateful configuration options. Applied to the process/session
(via gdalraster::set_config_option()), not as an algorithm argument.
gdal_open_opts(): driver open options.
gdal_creation_opts(): driver dataset- or layer-creation options, selected by level.
gdal_vsi_opts(): virtual file system (VSI) path-scoped options (config-like).
A gdal_opts value is rendered with as_gdal_args() (CLI token vector for
gdalraster::gdal_alg() / gdalraster::gdal_run()), as_config_option() (a NAME = VALUE
character vector for gdalraster::set_config_option(), config/VSI only), or gdal_render()
(a copy-pasteable shell snippet).
as_gdal_args(), as_config_option(), gdal_render(); and the typed per-driver builders
gpkg_open_opts(), gpq_creation_opts(), shp_open_opts(), fgb_creation_opts(),
gdb_open_opts().
Render a gdal_opts() object to a copy-pasteable, multi-line shell snippet with one
flag/value pair per line and the appropriate line-continuation for the target shell. Only the
option flags (and the leading --input-format/--output-format when the driver is known) are
rendered; the base gdal invocation and datasets are not included.
gdal_render(x, shell = c("bash", "sh", "pwsh", "cmd"))gdal_render(x, shell = c("bash", "sh", "pwsh", "cmd"))
x |
A |
shell |
Target shell dialect controlling quoting and continuation: |
A length-1 character string (embedded newlines), or "" when there are no options.
gdal_render(gdal_creation_opts(COMPRESSION = "ZSTD", driver = "Parquet"), shell = "bash")gdal_render(gdal_creation_opts(COMPRESSION = "ZSTD", driver = "Parquet"), shell = "bash")
Return a driver's capability flags (the DCAP_* metadata items) as a named logical vector.
gdal_vector_driver_capabilities(driver)gdal_vector_driver_capabilities(driver)
driver |
Character scalar GDAL driver short name. |
A named logical vector, one element per DCAP_* capability (name without the DCAP_
prefix retained as given by GDAL), TRUE where the capability is advertised.
gdal_vector_driver_capabilities("GPKG")gdal_vector_driver_capabilities("GPKG")
Accessors for a driver's configuration options (the --config channel). Configuration options
are sourced from curated package data, since GDAL does not expose them in driver metadata.
gdal_vector_driver_config_opts(): the configuration-option table for driver.
gdal_vector_driver_config_opts_defaults(): name to default (all, or one when opt_name given).
gdal_vector_driver_config_opts_values(): name to allowed values (only constrained options).
gdal_vector_driver_config_opts_types(): name to data_type.
gdal_vector_driver_config_opts(driver) gdal_vector_driver_config_opts_defaults(driver, opt_name = NULL) gdal_vector_driver_config_opts_values(driver, opt_name = NULL) gdal_vector_driver_config_opts_types(driver)gdal_vector_driver_config_opts(driver) gdal_vector_driver_config_opts_defaults(driver, opt_name = NULL) gdal_vector_driver_config_opts_values(driver, opt_name = NULL) gdal_vector_driver_config_opts_types(driver)
driver |
Character scalar GDAL driver short name. |
opt_name |
Optional single option name. When supplied, returns the value for that option only; otherwise returns the full named result. |
A tibble::tibble(), named character vector, or named list (see gdal_vector_driver_opts()).
gdal_config_opts(), gdal_vector_driver_opts()
gdal_vector_driver_config_opts("GPKG") gdal_vector_driver_config_opts_values("GPKG")gdal_vector_driver_config_opts("GPKG") gdal_vector_driver_config_opts_values("GPKG")
Accessors for a driver's creation options, parsed from both the dataset-level
(DMD_CREATIONOPTIONLIST, --co) and layer-level (DS_LAYER_CREATIONOPTIONLIST, --lco)
metadata. Use sub_type to restrict to one level.
gdal_vector_driver_creation_opts(): the creation-option table for driver.
gdal_vector_driver_creation_opts_defaults(): name to default (all, or one when opt_name given).
gdal_vector_driver_creation_opts_values(): name to allowed values (only constrained options).
gdal_vector_driver_creation_opts_types(): name to data_type.
gdal_vector_driver_creation_opts(driver, sub_type = NULL) gdal_vector_driver_creation_opts_defaults( driver, opt_name = NULL, sub_type = NULL ) gdal_vector_driver_creation_opts_values( driver, opt_name = NULL, sub_type = NULL ) gdal_vector_driver_creation_opts_types(driver, sub_type = NULL)gdal_vector_driver_creation_opts(driver, sub_type = NULL) gdal_vector_driver_creation_opts_defaults( driver, opt_name = NULL, sub_type = NULL ) gdal_vector_driver_creation_opts_values( driver, opt_name = NULL, sub_type = NULL ) gdal_vector_driver_creation_opts_types(driver, sub_type = NULL)
driver |
Character scalar GDAL driver short name. |
sub_type |
Optional creation level to restrict to: |
opt_name |
Optional single option name. When supplied, returns the value for that option only; otherwise returns the full named result. |
A tibble::tibble(), named character vector, or named list (see gdal_vector_driver_opts()).
gdal_creation_opts(), gdal_vector_driver_opts()
gdal_vector_driver_creation_opts("Parquet", sub_type = "layer") gdal_vector_driver_creation_opts_values("GPKG", sub_type = "layer")gdal_vector_driver_creation_opts("Parquet", sub_type = "layer") gdal_vector_driver_creation_opts_values("GPKG", sub_type = "layer")
Accessors for a driver's open options (the --oo / GDALOpenEx() channel), parsed from the
driver's DMD_OPENOPTIONLIST metadata.
gdal_vector_driver_open_opts(): the open-option table for driver.
gdal_vector_driver_open_opts_defaults(): name to default (all, or one when opt_name given).
gdal_vector_driver_open_opts_values(): name to allowed values (only constrained options).
gdal_vector_driver_open_opts_types(): name to data_type.
gdal_vector_driver_open_opts(driver) gdal_vector_driver_open_opts_defaults(driver, opt_name = NULL) gdal_vector_driver_open_opts_values(driver, opt_name = NULL) gdal_vector_driver_open_opts_types(driver)gdal_vector_driver_open_opts(driver) gdal_vector_driver_open_opts_defaults(driver, opt_name = NULL) gdal_vector_driver_open_opts_values(driver, opt_name = NULL) gdal_vector_driver_open_opts_types(driver)
driver |
Character scalar GDAL driver short name. |
opt_name |
Optional single option name. When supplied, returns the value for that option only; otherwise returns the full named result. |
A tibble::tibble(), named character vector, or named list (see gdal_vector_driver_opts()).
gdal_open_opts(), gdal_vector_driver_opts()
gdal_vector_driver_open_opts("GPKG") gdal_vector_driver_open_opts_values("GPKG", "LIST_ALL_TABLES")gdal_vector_driver_open_opts("GPKG") gdal_vector_driver_open_opts_values("GPKG", "LIST_ALL_TABLES")
Look up the documented options for the core supported vector drivers (see GDAL_VECTOR_DRIVERS), drawn from the merged option table assembled at package load (driver-metadata XML for open/creation options plus the curated configuration options).
gdal_vector_driver_opts(): the full option table, optionally filtered by type, sub_type,
and scope.
gdal_vector_driver_opt_defaults(): a named vector mapping option name to its declared default.
gdal_vector_driver_opt_values(): a named list mapping option name to its allowed values
(booleans expanded to c("YES", "NO")); only options that declare a constrained set appear.
gdal_vector_driver_opt_types(): a named vector mapping option name to its data_type.
gdal_vector_driver_opts( driver = NULL, type = NULL, sub_type = NULL, scope = NULL ) gdal_vector_driver_opt_defaults( driver, type = NULL, sub_type = NULL, scope = NULL ) gdal_vector_driver_opt_values( driver, type = NULL, sub_type = NULL, scope = NULL ) gdal_vector_driver_opt_types( driver, type = NULL, sub_type = NULL, scope = NULL )gdal_vector_driver_opts( driver = NULL, type = NULL, sub_type = NULL, scope = NULL ) gdal_vector_driver_opt_defaults( driver, type = NULL, sub_type = NULL, scope = NULL ) gdal_vector_driver_opt_values( driver, type = NULL, sub_type = NULL, scope = NULL ) gdal_vector_driver_opt_types( driver, type = NULL, sub_type = NULL, scope = NULL )
driver |
Character scalar GDAL driver short name (e.g. |
type |
Optional option channel to filter to: one of |
sub_type |
Optional creation sub-type to filter to: |
scope |
Optional data-type scope to filter to (e.g. |
gdal_vector_driver_opts(): a tibble::tibble() of options.
gdal_vector_driver_opt_defaults() / gdal_vector_driver_opt_types(): a named character vector.
gdal_vector_driver_opt_values(): a named list of character vectors.
gdal_vector_driver_open_opts(), gdal_vector_driver_creation_opts(),
gdal_vector_driver_config_opts()
gdal_vector_driver_opts("GPKG", type = "open") gdal_vector_driver_opt_defaults("GPKG", type = "open")gdal_vector_driver_opts("GPKG", type = "open") gdal_vector_driver_opt_defaults("GPKG", type = "open")
Construct a gdal_vsi_opts() object from NAME = value pairs, optionally scoped to a vsi_path.
These are config-like options for GDAL virtual file systems (e.g. cloud storage credentials and
HTTP tuning) and render as --config NAME=VALUE.
gdal_vsi_opts(..., vsi_path = NULL)gdal_vsi_opts(..., vsi_path = NULL)
... |
Named VSI options ( |
vsi_path |
Optional VSI path prefix (e.g. |
A gdal_vsi_opts() object.
gdal_vsi_opts(AWS_REGION = "us-east-1", vsi_path = "/vsis3/my-bucket")gdal_vsi_opts(AWS_REGION = "us-east-1", vsi_path = "/vsis3/my-bucket")
Construct a gdal_config_opts() object for the OpenFileGDB driver. Only options you supply are
emitted; boolean values are validated against the driver metadata.
gdb_config_opts( default_string_width = NULL, in_memory_spi = NULL, ..., .set_defaults = FALSE )gdb_config_opts( default_string_width = NULL, in_memory_spi = NULL, ..., .set_defaults = FALSE )
default_string_width |
Value for |
in_memory_spi |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_config_opts() object for the OpenFileGDB driver.
gdb_open_opts(), gdb_creation_opts(), gdal_config_opts()
gdb_config_opts(default_string_width = 1024L, in_memory_spi = TRUE)gdb_config_opts(default_string_width = 1024L, in_memory_spi = TRUE)
Construct a layer-level gdal_creation_opts() object for the OpenFileGDB driver. Typed
arguments cover the common layer options; advanced coordinate-precision grid options
(XORIGIN, XYSCALE, XYTOLERANCE, Z*/M*) may be supplied through ....
gdb_creation_opts( fid = NULL, geometry_name = NULL, geometry_nullable = NULL, configuration_keyword = NULL, target_arcgis_version = NULL, create_multipatch = NULL, create_shape_area_and_length_fields = NULL, time_in_utc = NULL, column_types = NULL, feature_dataset = NULL, layer_alias = NULL, documentation = NULL, ..., .set_defaults = FALSE )gdb_creation_opts( fid = NULL, geometry_name = NULL, geometry_nullable = NULL, configuration_keyword = NULL, target_arcgis_version = NULL, create_multipatch = NULL, create_shape_area_and_length_fields = NULL, time_in_utc = NULL, column_types = NULL, feature_dataset = NULL, layer_alias = NULL, documentation = NULL, ..., .set_defaults = FALSE )
fid |
Value for |
geometry_name |
Value for |
geometry_nullable |
Value for |
configuration_keyword |
Value for |
target_arcgis_version |
Value for |
create_multipatch |
Value for |
create_shape_area_and_length_fields |
Value for |
time_in_utc |
Value for |
column_types |
Value for |
feature_dataset |
Value for |
layer_alias |
Value for |
documentation |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A layer-level gdal_creation_opts() object for the OpenFileGDB driver.
gdb_open_opts(), gdal_creation_opts()
gdb_creation_opts(geometry_name = "SHAPE", target_arcgis_version = "ALL")gdb_creation_opts(geometry_name = "SHAPE", target_arcgis_version = "ALL")
Construct a gdal_open_opts() object for the OpenFileGDB driver.
gdb_open_opts(list_all_tables = NULL, ..., .set_defaults = FALSE)gdb_open_opts(list_all_tables = NULL, ..., .set_defaults = FALSE)
list_all_tables |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_open_opts() object for the OpenFileGDB driver.
gdb_creation_opts(), gdal_open_opts()
gdb_open_opts(list_all_tables = TRUE)gdb_open_opts(list_all_tables = TRUE)
Construct a gdal_config_opts() object for the GPKG driver. These are global configuration options
applied to the GDAL process.
gpkg_config_opts( sqlite_cache = NULL, sqlite_journal = NULL, sqlite_synchronous = NULL, sqlite_pragma = NULL, use_ogr_vfs = NULL, num_threads = NULL, ..., .set_defaults = FALSE )gpkg_config_opts( sqlite_cache = NULL, sqlite_journal = NULL, sqlite_synchronous = NULL, sqlite_pragma = NULL, use_ogr_vfs = NULL, num_threads = NULL, ..., .set_defaults = FALSE )
sqlite_cache |
Value for |
sqlite_journal |
Value for |
sqlite_synchronous |
Value for |
sqlite_pragma |
Value for |
use_ogr_vfs |
Value for |
num_threads |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_config_opts() object for the GPKG driver.
gpkg_open_opts(), gpkg_creation_opts(), gdal_config_opts()
gpkg_config_opts(sqlite_synchronous = "OFF", use_ogr_vfs = TRUE, num_threads = "ALL_CPUS")gpkg_config_opts(sqlite_synchronous = "OFF", use_ogr_vfs = TRUE, num_threads = "ALL_CPUS")
Construct a gdal_creation_opts() object for the GPKG driver. The typed arguments are
layer-creation options (level = "layer", the default, --lco); dataset-creation options
(VERSION, METADATA_TABLES, ADD_GPKG_OGR_CONTENTS, ...) are supplied through ... together
with level = "dataset".
gpkg_creation_opts( fid = NULL, geometry_name = NULL, geometry_nullable = NULL, spatial_index = NULL, identifier = NULL, description = NULL, launder = NULL, overwrite = NULL, ..., level = c("layer", "dataset"), .set_defaults = FALSE )gpkg_creation_opts( fid = NULL, geometry_name = NULL, geometry_nullable = NULL, spatial_index = NULL, identifier = NULL, description = NULL, launder = NULL, overwrite = NULL, ..., level = c("layer", "dataset"), .set_defaults = FALSE )
fid |
Name of the FID column ( |
geometry_name |
Name of the geometry column ( |
geometry_nullable |
Value for |
spatial_index |
Value for |
identifier |
Value for |
description |
Value for |
launder |
Value for |
overwrite |
Value for |
... |
Additional |
level |
Creation-option level, |
.set_defaults |
Logical. If |
A gdal_creation_opts() object for the GPKG driver.
gpkg_open_opts(), gdal_creation_opts()
gpkg_creation_opts(geometry_name = "geom", spatial_index = TRUE) gpkg_creation_opts(VERSION = "1.4", level = "dataset")gpkg_creation_opts(geometry_name = "geom", spatial_index = TRUE) gpkg_creation_opts(VERSION = "1.4", level = "dataset")
Construct a gdal_open_opts() object for the GPKG (GeoPackage) driver.
gpkg_open_opts( list_all_tables = NULL, prelude_statements = NULL, nolock = NULL, immutable = NULL, ..., .set_defaults = FALSE )gpkg_open_opts( list_all_tables = NULL, prelude_statements = NULL, nolock = NULL, immutable = NULL, ..., .set_defaults = FALSE )
list_all_tables |
Value for |
prelude_statements |
SQL/ |
nolock |
Value for |
immutable |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
Because a GeoPackage is a SQLite database, several open options carry performance and safety implications.
Of note is the PRELUDE_STATEMENTS open option, which allows you to specify arbitrary SQL statements that will
run before any other queries once connected to the SQLite3 connection is established. This is commonly used to
attach another database and issue cross-database requests, but
we use it more commonly here to set PRAGMA statements to optimize performance and avoid the global configuration
OGR_SQLITE_* options.
Each open option is enumerated and described below:
LIST_ALL_TABLES=[AUTO/YES/NO]: Defaults to AUTO. Whether all tables, including those not listed in gpkg_contents,
should be listed. If AUTO, all tables including those not listed in gpkg_contents will be listed, except if
the aspatial extension is found or a table is registered as 'attributes' in gpkg_contents. If YES,
all tables including those not listed in gpkg_contents will be listed, in all cases. If NO, only tables
registered as 'features', 'attributes' or 'aspatial' will be listed.
PRELUDE_STATEMENTS=[SQL]: (GDAL >= 3.2) SQL statement(s) to send on the SQLite3 connection before any other ones.
In case of several statements, they must be separated with the semicolon (;) sign. This option may be useful to
attach another database to the current one and issue cross-database requests.
NOLOCK=[YES/NO]: (GDAL >= 3.4.2) Defaults to NO. Whether the database should be used without doing any file
locking. Setting it to YES will only be honored when opening in read-only mode and if the journal mode is not WAL.
This corresponds to the nolock=1 query parameter described at https://www.sqlite.org/uri.html.
IMMUTABLE=[YES/NO]: (GDAL >= 3.5.3) Whether the database should be opened by assuming that the file cannot be
modified by another process. This will skip any checks for change detection. This can be useful for WAL
enabled files on read-only storage. GDAL will automatically try to turn it on when not being able to open in
read-only mode a WAL enabled file. This corresponds to the immutable=1 query parameter described at
https://www.sqlite.org/uri.html.
A gdal_open_opts() object for the GPKG driver.
gpkg_prelude_pragmas(), gpkg_creation_opts(), gdal_open_opts()
gpkg_open_opts(list_all_tables = FALSE, nolock = TRUE) prelude <- gpkg_prelude_pragmas(cache_size = -4000000, temp_store = "MEMORY") gpkg_open_opts(list_all_tables = FALSE, prelude_statements = prelude)gpkg_open_opts(list_all_tables = FALSE, nolock = TRUE) prelude <- gpkg_prelude_pragmas(cache_size = -4000000, temp_store = "MEMORY") gpkg_open_opts(list_all_tables = FALSE, prelude_statements = prelude)
PRAGMA StatementsBuild a PRELUDE_STATEMENTS string of SQLite PRAGMA directives for use as a GPKG/SQLite open option.
The result is a single semicolon-separated string. Because it embeds ; (and possibly ,), it is carried
as single --open-option value and rendered as such.
gpkg_prelude_pragmas( cache_size = NULL, temp_store = NULL, mmap_size = NULL, journal_mode = NULL, ... )gpkg_prelude_pragmas( cache_size = NULL, temp_store = NULL, mmap_size = NULL, journal_mode = NULL, ... )
cache_size |
Integer page cache size. Negative values are in kibibytes (e.g. |
temp_store |
Where temporary tables live: |
mmap_size |
Maximum bytes for memory-mapped I/O. |
journal_mode |
SQLite journal mode: |
... |
Additional raw |
A length-1 character string of semicolon-separated PRAGMA statements (or "").
gpkg_prelude_pragmas(cache_size = -4000000, temp_store = "MEMORY", journal_mode = "WAL")gpkg_prelude_pragmas(cache_size = -4000000, temp_store = "MEMORY", journal_mode = "WAL")
Construct a layer-level gdal_creation_opts() object for the Parquet (GeoParquet) driver. Only
options you supply are emitted; enumerated values are validated against the driver metadata.
gpq_creation_opts( compression = NULL, compression_level = NULL, geometry_encoding = NULL, row_group_size = NULL, geometry_name = NULL, fid = NULL, polygon_orientation = NULL, edges = NULL, creator = NULL, write_covering_bbox = NULL, covering_bbox_name = NULL, use_parquet_geo_types = NULL, sort_by_bbox = NULL, timestamp_with_offset = NULL, coordinate_precision = NULL, ..., .set_defaults = FALSE )gpq_creation_opts( compression = NULL, compression_level = NULL, geometry_encoding = NULL, row_group_size = NULL, geometry_name = NULL, fid = NULL, polygon_orientation = NULL, edges = NULL, creator = NULL, write_covering_bbox = NULL, covering_bbox_name = NULL, use_parquet_geo_types = NULL, sort_by_bbox = NULL, timestamp_with_offset = NULL, coordinate_precision = NULL, ..., .set_defaults = FALSE )
compression |
Value for |
compression_level |
Value for |
geometry_encoding |
Value for |
row_group_size |
Value for |
geometry_name |
Value for |
fid |
Value for |
polygon_orientation |
Value for |
edges |
Value for |
creator |
Value for |
write_covering_bbox |
Value for |
covering_bbox_name |
Value for |
use_parquet_geo_types |
Value for |
sort_by_bbox |
Value for |
timestamp_with_offset |
Value for |
coordinate_precision |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A layer-level gdal_creation_opts() object for the Parquet driver.
Following the OGC Best Practices for Distributing GeoParquet, good defaults for distribution
are ZSTD compression at a moderate level, a row-group size around 50000-150000, the per-row
bounding-box covering columns enabled, and spatially ordered features:
gpq_creation_opts( compression = "ZSTD", compression_level = 15, row_group_size = 100000, write_covering_bbox = TRUE, sort_by_bbox = TRUE )
gpq_open_opts(), gdal_creation_opts()
gpq_creation_opts(compression = "ZSTD", geometry_encoding = "WKB")gpq_creation_opts(compression = "ZSTD", geometry_encoding = "WKB")
Construct a gdal_open_opts() object for the Parquet (GeoParquet) driver.
gpq_open_opts( geom_possible_names = NULL, crs = NULL, lists_as_string_json = NULL, ..., .set_defaults = FALSE )gpq_open_opts( geom_possible_names = NULL, crs = NULL, lists_as_string_json = NULL, ..., .set_defaults = FALSE )
geom_possible_names |
Value for |
crs |
Value for |
lists_as_string_json |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_open_opts() object for the Parquet driver.
gpq_creation_opts(), gdal_open_opts()
gpq_open_opts(crs = "EPSG:4326")gpq_open_opts(crs = "EPSG:4326")
Check if a Path is a GDAL Virtual File System (VSI) Path or URL.
is_vsi_path(x)is_vsi_path(x)
x |
Character string to check. |
Logical indicating if the path starts with a valid VSI prefix (i.e. /vsicurl/ or /vsizip/).
is_vsi_path("/vsizip/data.zip") # TRUE is_vsi_path("/vsicurl/data.geojson") # TRUE is_vsi_path("data.geojson") # FALSEis_vsi_path("/vsizip/data.zip") # TRUE is_vsi_path("/vsicurl/data.geojson") # TRUE is_vsi_path("data.geojson") # FALSE
Retrieves the hash of a local file from its path.
local_hash(path, algo = "md5")local_hash(path, algo = "md5")
path |
Character string specifying the path to the local file. |
algo |
Character string specifying hash algorithm ("md5", "sha1", "sha256", "sha512"). |
A character string representing the hash of the local file.
## Not run: path <- "data-raw/cache/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" local_hash(path) ## End(Not run)## Not run: path <- "data-raw/cache/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" local_hash(path) ## End(Not run)
Pings a remote URL.
ping(url, timeout = 5L)ping(url, timeout = 5L)
url |
The remote URL |
timeout |
Timeout in seconds. Defaults to |
TRUE if successfully pinged, FALSE otherwise.
Downloads a remote file only if it has changed since the cached version. Uses HTTP Last-Modified header when available (fast), falls back to hash comparison for legacy servers.
remote_download( url, destfile, extract = FALSE, timeout = 600L, max_tries = 3L, force = FALSE, algo = "md5" )remote_download( url, destfile, extract = FALSE, timeout = 600L, max_tries = 3L, force = FALSE, algo = "md5" )
url |
Character string specifying the URL of the remote file. |
destfile |
Character string specifying the destination path. |
extract |
Logical; if |
timeout |
Numeric value specifying HTTP request timeout in seconds. Defaults to |
max_tries |
Integer; maximum number of download attempts on failure. Defaults to |
force |
Logical; if |
algo |
Character string specifying hash algorithm ("md5", "sha1", "sha256", "sha512"). Only used as fallback if Last-Modified header unavailable. |
Invisibly returns the path to the downloaded file.
Determines whether a remote file exists by sending a HEAD request to the specified
URL and checking the HTTP status code.
remote_exists(url)remote_exists(url)
url |
Character string specifying the URL of the remote file. |
A logical value: TRUE if the remote file exists (HTTP status 200), FALSE otherwise.
## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_exists(url) ## End(Not run)## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_exists(url) ## End(Not run)
Retrieves the hash of a remote file from its URL.
remote_hash(url, algo = "md5")remote_hash(url, algo = "md5")
url |
Character string specifying the URL of the remote file. |
algo |
Character string specifying hash algorithm ("md5", "sha1", "sha256", "sha512"). |
A character string representing the hash of the remote file.
## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_hash(url) ## End(Not run)## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_hash(url) ## End(Not run)
HEAD HTTP Request for a Remote URLSends a HEAD request to the specified URL and retrieves the response headers.
This function is useful for checking the existence of a resource or retrieving metadata without downloading the entire content.
remote_head(url)remote_head(url)
url |
Character string specifying the URL to send the |
A list containing:
request: The httr2::request()
response: The httr2::response()
headers: The httr2::resp_headers() from the response
## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" head_info <- remote_head(url) print(head_info$headers) ## End(Not run)## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" head_info <- remote_head(url) print(head_info$headers) ## End(Not run)
These functions derive timestamps for local and remote resources.
remote_last_modified(): Parses the Last-Modified HTTP response header as the timestamp.
Returns NA if the header is not available.
local_last_modified(): Local file last modified timestamp.
remote_last_modified(url) local_last_modified(path)remote_last_modified(url) local_last_modified(path)
url |
Character string specifying the URL of the remote file. |
path |
Path to local file to get the last modified timestamp for. |
remote_last_modified(): POSIXct datetime representing the Last-Modified header timestamp, or NA if not provided by the
server.
local_last_modified(): POSIXct datetime of the file's last modification.
## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_last_modified(url) path <- "data-raw/cache/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" local_last_modified(path) ## End(Not run)## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_last_modified(url) path <- "data-raw/cache/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" local_last_modified(path) ## End(Not run)
Performs a GET request against an Apache-style autoindex URL and returns
the relative file/directory hrefs listed on the page. Works with Census
Bureau TIGER and GENZ directory listings.
remote_list(url, pattern = NULL, full_url = FALSE)remote_list(url, pattern = NULL, full_url = FALSE)
url |
Character. The directory index URL (must return |
pattern |
Optional regex to filter returned hrefs (e.g. |
full_url |
Logical. If |
A character vector of relative (or absolute, if full_url = TRUE)
file/directory hrefs, NAs and navigation links excluded.
Retrieves the size of a remote file by sending a HEAD request to the specified
URL and extracting the Content-Length header.
remote_size(url)remote_size(url)
url |
Character string specifying the URL of the remote file. |
A numeric value representing the size of the remote file in bytes.
## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_size(url) ## End(Not run)## Not run: url <- "https://www2.census.gov/geo/tiger/GENZ2024/shp/cb_2024_us_state_20m.zip" remote_size(url) ## End(Not run)
Construct a gdal_config_opts() object for the ESRI Shapefile driver. These are global GDAL
configuration options applied to the process (via gdalraster::set_config_option() /
--config). Only options you supply are emitted.
shp_config_opts( shape_rewind_on_write = NULL, shape_restore_shx = NULL, shape_2gb_limit = NULL, shape_encoding = NULL, ..., .set_defaults = FALSE )shp_config_opts( shape_rewind_on_write = NULL, shape_restore_shx = NULL, shape_2gb_limit = NULL, shape_encoding = NULL, ..., .set_defaults = FALSE )
shape_rewind_on_write |
Value for |
shape_restore_shx |
Value for |
shape_2gb_limit |
Value for |
shape_encoding |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_config_opts() object for the ESRI Shapefile driver.
shp_open_opts(), shp_creation_opts(), gdal_config_opts()
shp_config_opts(shape_restore_shx = TRUE)shp_config_opts(shape_restore_shx = TRUE)
Construct a layer-level gdal_creation_opts() object for the ESRI Shapefile driver.
shp_creation_opts( spatial_index = NULL, encoding = NULL, resize = NULL, shpt = NULL, two_gb_limit = NULL, auto_repack = NULL, dbf_date_last_update = NULL, dbf_eof_char = NULL, ..., .set_defaults = FALSE )shp_creation_opts( spatial_index = NULL, encoding = NULL, resize = NULL, shpt = NULL, two_gb_limit = NULL, auto_repack = NULL, dbf_date_last_update = NULL, dbf_eof_char = NULL, ..., .set_defaults = FALSE )
spatial_index |
Value for |
encoding |
Value for |
resize |
Value for |
shpt |
Value for |
two_gb_limit |
Value for |
auto_repack |
Value for |
dbf_date_last_update |
Value for |
dbf_eof_char |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A layer-level gdal_creation_opts() object for the ESRI Shapefile driver.
shp_open_opts(), gdal_creation_opts()
shp_creation_opts(spatial_index = TRUE, encoding = "UTF-8")shp_creation_opts(spatial_index = TRUE, encoding = "UTF-8")
Construct a gdal_open_opts() object for the ESRI Shapefile driver.
shp_open_opts( encoding = NULL, dbf_date_last_update = NULL, adjust_type = NULL, adjust_geom_type = NULL, auto_repack = NULL, dbf_eof_char = NULL, ..., .set_defaults = FALSE )shp_open_opts( encoding = NULL, dbf_date_last_update = NULL, adjust_type = NULL, adjust_geom_type = NULL, auto_repack = NULL, dbf_eof_char = NULL, ..., .set_defaults = FALSE )
encoding |
Value for |
dbf_date_last_update |
Value for |
adjust_type |
Value for |
adjust_geom_type |
Value for |
auto_repack |
Value for |
dbf_eof_char |
Value for |
... |
Additional |
.set_defaults |
Logical. If |
A gdal_open_opts() object for the ESRI Shapefile driver.
shp_config_opts(), shp_creation_opts(), gdal_open_opts()
shp_open_opts(encoding = "UTF-8", auto_repack = TRUE)shp_open_opts(encoding = "UTF-8", auto_repack = TRUE)
ST_IsValid WHERE ClauseConstructs a SQL ST_IsValid() expression for filtering geometries.
sql_where_valid_geom(geom_col, negate = FALSE)sql_where_valid_geom(geom_col, negate = FALSE)
geom_col |
Character. The name of the geometry column. |
negate |
Logical. If |
A character string containing the SQL expression.
sql_where_valid_geom("geom") sql_where_valid_geom("geom", negate = TRUE)sql_where_valid_geom("geom") sql_where_valid_geom("geom", negate = TRUE)
sys_available_ram - System Available RAMGet the amount of usable physical RAM available to the R session using gdalraster::get_usable_physical_ram(),
which calls the CPLGetUsablePhysicalRAM() C++ function from GDAL's Common Portable Library (CPL).
sys_available_ram()sys_available_ram()
This function returns the total physical RAM usable by a process, in bytes.
It will be limited to 2GB for 32-bit processes.
It takes into account resource limits (virtual memory) of POSIX systems. It additionally will take into account
RLIMIT_RSS on Linux.
On Windows, it will return the total physical RAM minus the memory used by the system and other processes, as reported by the Windows API, in bytes.
A numeric scalar representing the number of bytes as a bit64::integer64() type (or zero 0 in case of failure).
This memory may already be partly accounted for by other processes, but is still useful for estimating how much RAM is available for processing large vector data without causing out-of-memory errors.
It is used by the check_available_ram() check utility which is used in fgb_validate_spatial_index_ram() to
ensure that there is sufficient RAM to build a spatial index for a given dataset:
"The creation of the packet Hilbert R-Tree requires an amount of RAM which is at least the number of features times 83 bytes."
## Not run: sys_available_ram() ## End(Not run)## Not run: sys_available_ram() ## End(Not run)
sys_error_code - System Error CodesGet system error codes and their descriptions. If a specific code is provided, returns the name, value, and description for that code. If no code is provided, returns a tibble of all system error codes.
sys_error_code(code = NULL)sys_error_code(code = NULL)
code |
(Optional) Integer or character string representing the system error code to look up.
If |
A tibble::tibble() with the name, value, and description of the system error code(s).
If one or more codes are provided, returns only the matching code(s). If no codes are found, returns NULL invisibly.
ps::errno() for the underlying system error codes data.
## Not run: # Get all system error codes sys_error_code() # Get specific error code information sys_error_code(2) # Example: ENOENT (No such file or directory) ## End(Not run)## Not run: # Get all system error codes sys_error_code() # Get specific error code information sys_error_code(2) # Example: ENOENT (No such file or directory) ## End(Not run)
sys_num_cpus - System Number of CPUsGet the number of CPU cores available on the current machine using gdalraster::get_num_cpus(),
which calls the internal GDAL C++ library function GDALGetCPUs().
sys_num_cpus()sys_num_cpus()
This method is more robust than parallel::detectCores() because it accounts for CPU
affinity, container limits, and other environmental restrictions that may cap the processing
pools actually available to the R session.
However, on a standard unconstrained desktop machine, it will return the same value as
parallel::detectCores(logical = TRUE) because both report the total logical processing channels.
Number of CPUs (GDAL): gdalraster::get_num_cpus() queries the C++ backend to see how many logical
execution slots (hardware threads) are exposed by the operating system.
Number of Cores (parallel): parallel::detectCores(logical = TRUE) targets the virtual threads generated
by Hyper-Threading (Intel) or SMT (AMD). Conversely, running parallel::detectCores(logical = FALSE) attempts
to return only the count of independent physical cores on the processor.
Integer representing the number of CPU cores available to the R session.
## Not run: sys_num_cpus() ## End(Not run)## Not run: sys_num_cpus() ## End(Not run)
sys_os - System OS NameGet the current machine's operating system name.
sys_os()sys_os()
Character string resulting from Sys.info()[["sysname"]], which will be one of c("windows", "linux", "darwin", etc.)
depending on the system.
## Not run: sys_os() ## End(Not run)## Not run: sys_os() ## End(Not run)
sys_path - System PATHGet the Current Machine's PATH Environment Variable as a Character Vector
sys_path(filter = NULL)sys_path(filter = NULL)
filter |
Optional character string. If provided, only paths containing this string will be returned. |
Character vector of paths from the system's PATH environment variable, split by the appropriate path separator
for the operating system. If filter is provided, only paths containing the filter string are included in the
returned vector. If no paths match the filter, an empty character vector is returned: character(0).
If filter is provided, only paths containing the filter string are returned.
## Not run: sys_path() ## End(Not run)## Not run: sys_path() ## End(Not run)
sys_pid - System Process IDGet the current process ID of the R session.
sys_pid()sys_pid()
Integer representing the current process ID.
## Not run: sys_pid() ## End(Not run)## Not run: sys_pid() ## End(Not run)
sys_platform - System PlatformGet the current machine's platform (operating system "family")
sys_platform()sys_platform()
Character string resulting from .Platform$OS.type
## Not run: sys_platform() ## End(Not run)## Not run: sys_platform() ## End(Not run)
sys_which - System which
Lightweight, convenience wrapper around base::Sys.which() and base::normalizePath().
sys_which(x, winslash = "/", ...)sys_which(x, winslash = "/", ...)
x |
Passed to |
winslash |
the separator to be used on Windows – ignored
elsewhere. Must be one of |
... |
Arguments passed on to
|
Character vector of paths, if found. If not found returns NULL instead of "".
## Not run: sys_which("gdal") ## End(Not run)## Not run: sys_which("gdal") ## End(Not run)
Check a gdal_opts() object against its driver's registered metadata: unknown option names,
invalid enumerated (string-select) values, and invalid boolean values. Validation is advisory
and non-blocking - it warns (with classed conditions) and returns a logical, leaving the decision
to act at the call site.
validate_gdal_opts(x, driver = attr(x, "driver"), call = rlang::caller_env())validate_gdal_opts(x, driver = attr(x, "driver"), call = rlang::caller_env())
x |
A |
driver |
GDAL driver short name; defaults to the object's |
call |
The execution environment of a currently
running function, e.g. |
Invisibly, TRUE if valid, FALSE if any problems were found, or NA if validation
could not be performed (no driver).
validate_gdal_opts(gdal_open_opts(LIST_ALL_TABLES = "NO", driver = "GPKG"))validate_gdal_opts(gdal_open_opts(LIST_ALL_TABLES = "NO", driver = "GPKG"))
/vsiaz/ PathBuild a /vsiaz/ Path
vsi_azure(container, blob)vsi_azure(container, blob)
container |
Azure Blob container name. |
blob |
Blob path within the container. |
Character scalar.
/vsicurl/
Wrap a URL with /vsicurl/
vsi_curl(url)vsi_curl(url)
url |
URL to wrap. |
Character vector of /vsicurl/ paths.
Test Whether a VSI Path Exists
vsi_exists(path)vsi_exists(path)
path |
Path to test. |
Logical vector.
Convert a URI to a GDAL VSI Path
vsi_from_uri(uri)vsi_from_uri(uri)
uri |
URI or URL. |
Character vector of VSI paths.
List VSI Handlers Used by a Path
vsi_handlers(path)vsi_handlers(path)
path |
VSI path. |
Character vector of handler names.
Get VSI File Metadata
vsi_meta(path, domain = "HEADERS")vsi_meta(path, domain = "HEADERS")
path |
Path to inspect. |
domain |
Metadata domain, typically |
Named character vector of metadata entries.
Convert a Path to a GDAL VSI Path
vsi_path(path, ...)vsi_path(path, ...)
path |
A path, URL, or object with a |
... |
Passed to methods. |
Character vector of VSI paths.
Get the Size of a VSI Path
vsi_size(path)vsi_size(path)
path |
Path to inspect. |
The size of the file/object in bytes, formatted using rlang::as_bytes().
Strip the Outermost VSI Handler
vsi_strip(path, recurse = TRUE)vsi_strip(path, recurse = TRUE)
path |
Path to strip. |
recurse |
Logical; if |
Character vector with the outermost VSI handler removed.
Sync Between VSI Paths
vsi_sync(src, dst, ...)vsi_sync(src, dst, ...)
src |
Source path. |
dst |
Destination path. |
... |
Passed to |
Invisibly returns the sync result from GDAL.
Get the Type of a VSI Path
vsi_type(path)vsi_type(path)
path |
Path to inspect. |
Character vector of path types.
/vsizip/
Wrap a Path with /vsizip/
vsi_zip(path)vsi_zip(path)
path |
Path to a ZIP archive. |
Character vector of /vsizip/ paths.
/vsizip//vsicurl/ PathBuild a /vsizip//vsicurl/ Path
vsi_zip_curl(url, inner = NULL)vsi_zip_curl(url, inner = NULL)
url |
Remote ZIP URL. |
inner |
Optional inner file path within the ZIP archive. |
Character scalar.
Parses the configuration options for a GDAL driver from the provided XML document. This function
is specifically designed to extract the configuration options listed in the "Configuration Options" section of a GDAL
driver's documentation page, which is typically structured as an unordered list (<ul>) with list
items (<li>) containing the option details.
The function looks for the first <ul> element within the section with id="configuration-options" and extracts
the option name, description, default value, and possible values (if specified in brackets).
The resulting data is returned as a tibble with columns for name, description, scope, default, and values
(a list-column containing character vectors of possible values).
xml_parse_gdal_driver_config_opts( xml, scope = "all", driver = NULL, type = "config", call = rlang::caller_env() )xml_parse_gdal_driver_config_opts( xml, scope = "all", driver = NULL, type = "config", call = rlang::caller_env() )
xml |
The XML document to parse, typically obtained from a GDAL driver's documentation page. |
scope |
The scope of the options being parsed, such as "vector", "raster", or "all". This is used to categorize the options based on their applicability to different data types. Defaults to "all". |
driver |
The name of the GDAL driver for which the options are being parsed.
This is used for labeling purposes in the resulting tibble. Defaults to |
type |
The type of options being parsed, such as "config", "open", or "creation". This is used for labeling purposes in the resulting tibble. Defaults to "config". |
call |
The calling function, used for error handling and messaging. |
A tibble with columns for name, description, scope, default, and values
Parses the XML from GDAL driver metadata into structured tbl_df tibbles.
The function is meant to be flexible enough to be able to parse any of the possible
XML metadata structures from GDAL's registered (vector) driver's metadata:
DMD_OPENOPTIONLIST, DMD_CREATIONOPTIONLIST, and DS_LAYER_CREATIONOPTIONLIST.
xml_parse_gdal_options( xml, driver = NA_character_, type = c("config", "open", "creation"), sub_type = NA_character_, scope = c("vector", "raster", "all"), call = rlang::caller_env() )xml_parse_gdal_options( xml, driver = NA_character_, type = c("config", "open", "creation"), sub_type = NA_character_, scope = c("vector", "raster", "all"), call = rlang::caller_env() )
xml |
The XML to be parsed. Must be either a valid XML character string or an |
driver |
(Optional) GDAL driver name added to the resulting |
type |
The option type being parsed, one of |
sub_type |
For |
scope |
(Optional) The scope of the options being parsed in terms of the supported data types, i.e. |
call |
The calling function, used for error handling and messaging. |
tibble::tibble() with fields for name, description, scope, type, default, and
values (a list-column with a character vector for the possible values).
Additional fields for driver and opt_type may be included if those parameters are provided.
# parse DS_LAYER_CREATIONOPTIONLIST gdalraster::gdal_get_driver_md("GPKG", mdi_name = "DS_LAYER_CREATIONOPTIONLIST") |> xml_parse_gdal_options() # parse DMD_CREATIONOPTIONLIST gdalraster::gdal_get_driver_md("GPKG", mdi_name = "DMD_CREATIONOPTIONLIST") |> xml_parse_gdal_options() # parse DMD_OPENOPTIONLIST gdalraster::gdal_get_driver_md("GPKG", mdi_name = "DMD_OPENOPTIONLIST") |> xml_parse_gdal_options()# parse DS_LAYER_CREATIONOPTIONLIST gdalraster::gdal_get_driver_md("GPKG", mdi_name = "DS_LAYER_CREATIONOPTIONLIST") |> xml_parse_gdal_options() # parse DMD_CREATIONOPTIONLIST gdalraster::gdal_get_driver_md("GPKG", mdi_name = "DMD_CREATIONOPTIONLIST") |> xml_parse_gdal_options() # parse DMD_OPENOPTIONLIST gdalraster::gdal_get_driver_md("GPKG", mdi_name = "DMD_OPENOPTIONLIST") |> xml_parse_gdal_options()