gpkg_table_pragma | R Documentation |
gpkg_table_pragma()
: Get information on a table in a GeoPackage (without returning the whole table).
gpkg_table()
: Access a specific table (by name) and get a tbl_SQLiteConnection object referencing that table
gpkg_collect()
: Alias for gpkg_table(..., collect=TRUE)
gpkg_tbl()
: Alias for gpkg_table(..., collect=FALSE)
(default) that always returns a tbl_SQLiteConnection object.
gpkg_rast()
: Get a SpatRaster object corresponding to the specified table_name
gpkg_vect()
: Get a SpatVector object corresponding to the specified table_name
gpkg_sf()
: Get a sf-tibble object corresponding to the specified table_name
gpkg_table_pragma(x, table_name = NULL, ...)
## Default S3 method:
gpkg_table_pragma(x, table_name = NULL, ...)
gpkg_table(
x,
table_name,
collect = FALSE,
column_names = "*",
query_string = FALSE,
...
)
## Default S3 method:
gpkg_table(
x,
table_name,
collect = FALSE,
column_names = "*",
query_string = FALSE,
...
)
gpkg_collect(x, table_name, query_string = FALSE, ...)
gpkg_tbl(x, table_name, ...)
gpkg_rast(x, table_name = NULL, ...)
gpkg_vect(x, table_name, ...)
gpkg_sf(x, table_name, ...)
x |
A geopackage object or character path to GeoPackage file |
table_name |
character. One or more table names; for |
... |
Additional arguments. In |
collect |
logical. Materialize a data.frame object in memory? Default: |
column_names |
character. Used only when |
query_string |
logical. Return SQLite query rather than executing it? Default: |
gpkg_table()
: A 'dbplyr' object of class tbl_SQLiteConnection
gpkg_collect()
: An object of class data.frame
gpkg_tbl()
: An object of class tbl_SQLiteConnection
gpkg_rast()
: A 'terra' object of class SpatRaster
gpkg_vect()
: A 'terra' object of class SpatVector (may not contain geometry columns)
gpkg_sf())
: An sf-tibble object of class "sf"
, "tbl_df"
. If the table contains no geometry column the result is a "tbl_df"
.
tf <- tempfile(fileext = ".gpkg")
r <- terra::rast(system.file("extdata", "dem.tif", package = "gpkg"))
gpkg_write(r,
destfile = tf,
RASTER_TABLE = "DEM1",
FIELD_NAME = "Elevation")
gpkg_write(r,
destfile = tf,
append = TRUE,
RASTER_TABLE = "DEM2",
FIELD_NAME = "Elevation")
g <- geopackage(tf, connect = TRUE)
# inspect gpkg_contents table
gpkg_table(g, "gpkg_contents")
gpkg_contents(g)
# materialize a data.frame from gpkg_2d_gridded_tile_ancillary
library(dplyr, warn.conflicts = FALSE)
gpkg_table(g, "gpkg_2d_gridded_tile_ancillary") %>%
dplyr::filter(tpudt_name == "DEM2") %>%
dplyr::select(mean, std_dev) %>%
dplyr::collect()
gpkg_disconnect(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.