Skip to content

Commit

Permalink
gpkg_tables: add error handling for terra::vect() with a non-spatial …
Browse files Browse the repository at this point in the history
…fallback
  • Loading branch information
brownag committed Feb 13, 2024
1 parent 0f85699 commit a973c8f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/gpkg-util.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ gpkg_tables.geopackage <- function(x, collect = FALSE, pragma = FALSE) {
unlist(lapply(names(y), function(z) {
switch(z,
"2d-gridded-coverage" = { sapply(y[[z]]$table_name, function(i) terra::rast(src, i)) },
"features" = { sapply(y[[z]]$table_name, function(i) terra::vect(src, proxy = !collect, layer = i)) },
"features" = { sapply(y[[z]]$table_name, function(i) {
res <- try(terra::vect(src, proxy = !collect, layer = i), silent = TRUE)
if (inherits(res, 'try-error')) {
message(i, " : ", res[1])
res <- .LAZY.FUN(xx, table_name = i)
}
res
}) },
"attributes" = { sapply(y[[z]]$table_name, function(i) list(.LAZY.FUN(xx, table_name = i))) })
}), recursive = FALSE)
}
Expand Down

0 comments on commit a973c8f

Please sign in to comment.