| gpkg_write | R Documentation |
Write data to a GeoPackage
gpkg_write(
x,
y = NULL,
table_name = NULL,
datatype = "FLT4S",
append = FALSE,
overwrite = FALSE,
NoData = NULL,
gdal_options = NULL,
auto_nodata = TRUE,
destfile = NULL,
...
)
x |
Vector of source file path(s), or a list containing one or more SpatRaster, SpatRasterCollection, SpatVectorProxy, or data.frame objects. |
y |
character, geopackage, or DBIConnection. |
table_name |
character. Default |
datatype |
character. Data type. Defaults to |
append |
logical. Append to existing data source? Default: |
overwrite |
logical. Overwrite existing data source? Default |
NoData |
numeric. Value to use as GDAL |
gdal_options |
character. Additional |
auto_nodata |
logical. If TRUE (default), automatically select a datatype-appropriate
default NoData value when |
destfile |
character. Path to output GeoPackage |
... |
Additional arguments are passed as GeoPackage creation options. See Details. |
gpkg_write() can write multiple layers of different types (raster,
vector, and attributes) in a single call when x is a list. If calling
gpkg_write() multiple times to build a GeoPackage, use append=TRUE
to add additional layers. To replace a specific table while preserving
others, use overwrite=TRUE. Note that overwrite=TRUE only drops the
specified table_name and does not affect other tables in the file.
Additional, non-default GeoPackage creation options can be specified
as arguments to this function. The full list of creation options can be
viewed
here
or in the gpkg_creation_options dataset. The name of the argument is
creation_option and the value is selected from one of the elements of
values for that option.
If x contains source file paths, any comma-separated value (CSV) files
are treated as attribute data–even if they contain a geometry column.
GeoPackage source file paths are always treated as vector data sources, and
only one layer will be read from the source and written to the target. If
you need to read raster data from a GeoPackage first create a SpatRaster
from the layer of interest (see gpkg_rast()) before passing to
gpkg_write(). If you need to read multiple layers from any multi-layer
source read them individually into suitable objects. For a source
GeoPackage containing multiple layers you can use gpkg_read() (returns a
geopackage object) or gpkg_tables() (returns a list object).
Logical. TRUE on successful write of at least one grid.
gpkg_creation_options gpkg_default_nodata()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.