From 336e9bc2465521725fb4605882152d943d1421be Mon Sep 17 00:00:00 2001 From: Andrew Gene Brown Date: Sun, 3 Mar 2024 08:39:20 -0800 Subject: [PATCH] gpkg_read: use internal geopackage constructor to avoid error with pre-existing GPKG --- R/gpkg-io.R | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/R/gpkg-io.R b/R/gpkg-io.R index e3e2ef9..a6a6eef 100644 --- a/R/gpkg-io.R +++ b/R/gpkg-io.R @@ -55,11 +55,10 @@ gpkg_read <- function(x, connect = FALSE, quiet = TRUE) { res2 <- do.call('c', lapply(res, function(x) x$tables)) names(res2) <- do.call('c', lapply(res, function(x) names(x$tables))) - g <- geopackage(res2, dsn = x) - if (connect) { - gpkg_connect(g) - } - g + + obj <- .geopackage(dsn = x, connect = connect) + obj$tables <- x + obj } #' Write data to a GeoPackage