Skip to content

Commit

Permalink
for #317
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Nov 18, 2023
1 parent 0a43529 commit b97d4c8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/createSSURGO.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ createSSURGO <- function(filename,

if (!is.null(msidxdet)) {
indexPK <- na.omit(msidxdet[[4]][msidxdet[[1]] == mstab_lut[x] & grepl("PK_", msidxdet[[2]])])
indexDI <- na.omit(msidxdet[[4]][msidxdet[[1]] == mstab_lut[x] & grepl("DI_", msidxdet[[2]])])
}

d <- try(as.data.frame(data.table::rbindlist(lapply(seq_along(f.txt.grp[[x]]), function(i) {
Expand Down Expand Up @@ -241,6 +242,16 @@ createSSURGO <- function(filename,
}, silent = quiet)
}

# create key indices
if (!is.null(indexDI) && length(indexDI) > 0) {
for (i in seq_along(indexDI)) {
try({
RSQLite::dbExecute(con, sprintf("CREATE INDEX IF NOT EXISTS %s ON %s (%s)",
paste0('DI_', mstab_lut[x]), mstab_lut[x], indexDI[i]))
}, silent = quiet)
}
}

# for GPKG output, add gpkg_contents (metadata for features and attributes)
if (IS_GPKG) {
# update gpkg_contents table entry
Expand Down

0 comments on commit b97d4c8

Please sign in to comment.