gpkg_bbox: Get Bounding Box of a GeoPackage Layer

View source: R/gpkg_bbox.R

gpkg_bboxR Documentation

Get Bounding Box of a GeoPackage Layer

Description

This function applies an OGR SQL query to obtain bounding coordinates of a table containing a geometry column. https://gdal.org/en/stable/user/sql_sqlite_dialect.html and https://gdal.org/en/stable/user/ogr_sql_dialect.html

Usage

gpkg_bbox(x, table_name, geom_column = "geom")

Arguments

x

A geopackage object

table_name

character. One or more table names.

geom_column

character. Geometry column name, default "geom"

Value

a data.frame containing columns "xmin", "ymin", "xmax", "ymax"

Examples



tf <- tempfile(fileext = ".gpkg")

r <- terra::rast(system.file("extdata", "dem.tif", package = "gpkg"))
v <- terra::as.polygons(r, ext = TRUE)
g <- geopackage(list(bbox = v))

gpkg_bbox(g, 'bbox')



gpkg documentation built on April 3, 2025, 8:55 p.m.