createSSURGO: Create a database from SSURGO Exports
Description
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.
Character. Vector of layer/table names in filename.
Arguments
filename
Output file name (e.g. 'db.sqlite' or 'db.gpkg'). Only used when con 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. When include_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.