The following database types are tested and fully supported:
SQLite or Geopackage
DuckDB
Postgres or PostGIS
In theory any other DBI-compatible data source can be used for output. See conn
argument. If you encounter issues using specific DBI connection types, please report in the soilDB issue tracker.
Usage
createSSURGO(
filename,
exdir,
conn = NULL,
pattern = NULL,
include_spatial = TRUE,
overwrite = FALSE,
header = FALSE,
quiet = TRUE,
...
)
Arguments
- filename
Output file name (e.g.
'db.sqlite'
or'db.gpkg'
). Only used whencon
is not specified by the user.- exdir
Path containing containing input SSURGO spatial (.shp) and tabular (.txt) files, downloaded and extracted by
downloadSSURGO()
or similar.- conn
A DBIConnection object. Default is a
SQLiteConnection
used for writing .sqlite or .gpkg files. Alternate options are any DBI connection types. Wheninclude_spatial=TRUE
, the sf package is used to write spatial data to the database.- pattern
Character. Optional regular expression to use to filter subdirectories of
exdir
. Default:NULL
will search all subdirectories for SSURGO export files.- include_spatial
Logical. Include spatial data layers in database? Default:
TRUE
.- overwrite
Logical. Overwrite existing layers? Default
FALSE
will append to existing tables/layers.- header
Logical. Passed to
read.delim()
for reading pipe-delimited (|
) text files containing tabular data.- quiet
Logical. Suppress messages and other output from database read/write operations?
- ...
Additional arguments passed to
write_sf()
for writing spatial layers.
Examples
if (FALSE) { # \dontrun{
downloadSSURGO("areasymbol IN ('CA067', 'CA077', 'CA632')", destdir = "SSURGO_test")
createSSURGO("test.gpkg", "SSURGO_test")
} # }