@@ -325,7 +325,7 @@ get_mapunit_from_GDB <- function(dsn = "gNATSGO_CONUS.gdb",
325325 }
326326 )
327327 pmg <- sf :: read_sf(dsn = dsn , query = qry , as_tibble = FALSE , fid_column_name = " copmgrpkey" )
328-
328+ pmg $ copmgrpkey.1 <- NULL
329329
330330 # remove duplicate rvindicators
331331 dat <- as.data.frame.matrix(table(pmg $ cokey , pmg $ rvindicator ))
@@ -647,6 +647,12 @@ fetchGDB <- function(dsn = "gNATSGO_CONUS.gdb",
647647 stop(" package 'aqp' is required" , call. = FALSE )
648648 }
649649
650+ stopifnot(length(WHERE ) < = 1 )
651+ whr <- WHERE
652+ if (is.null(whr )) {
653+ whr <- basename(dsn )
654+ }
655+
650656 # checks
651657 vars_le <- vars_le <- sf :: read_sf(dsn = dsn , query = " SELECT * FROM legend LIMIT 0" , as_tibble = FALSE , fid_column_name = " lkey" ) | > names() | > paste(collapse = " |" )
652658
@@ -703,7 +709,7 @@ fetchGDB <- function(dsn = "gNATSGO_CONUS.gdb",
703709 if (idx_le ) {
704710 message(" getting components and horizons from areasymbol = '" , unique(x $ idx ), " '" )
705711 } else {
706- message(" getting components and horizons from " , WHERE )
712+ message(" getting components and horizons from " , whr )
707713 }
708714
709715 # components
@@ -744,7 +750,7 @@ fetchGDB <- function(dsn = "gNATSGO_CONUS.gdb",
744750
745751 if (idx_co || is.null(WHERE )) {
746752
747- message(" getting components and horizons from " , WHERE )
753+ message(" getting components and horizons from " , whr )
748754
749755 # target component table ----
750756 co <- get_component_from_GDB(
@@ -766,8 +772,14 @@ fetchGDB <- function(dsn = "gNATSGO_CONUS.gdb",
766772 childs = childs )
767773 }
768774
769- le $ lkey.1 <- NULL
770- mu $ mukey.1 <- NULL
775+ if (idx_le ) {
776+ le $ lkey.1 <- NULL
777+ }
778+
779+ if (idx_mu ) {
780+ mu $ mukey.1 <- NULL
781+ }
782+
771783 co $ cokey.1 <- NULL
772784 h $ chkey.1 <- NULL
773785
0 commit comments