Created
October 3, 2022 22:14
-
-
Save dblodgett-usgs/61425b5cb58bd570a47e7ed054a8d7b5 to your computer and use it in GitHub Desktop.
remove gpkg layer with R using RSQLite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_gpkg_table <- function(db, table) { | |
con <- RSQLite::dbConnect(RSQLite::SQLite(), db) | |
on.exit(RSQLite::dbDisconnect(con)) | |
o <- RSQLite::dbRemoveTable(con, table) | |
o <- RSQLite::dbSendQuery(con, sprintf("DELETE FROM gpkg_contents where table_name='%s';", table)) | |
RSQLite::dbClearResult(o) | |
} |
lol -- I've searched for this a number of times and totally missed that st_delete exists. Thanks @edzer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For completeness:
sf::st_delete()
does this.