Closed NewGraphEnvironment closed 2 months ago
here is an example of using gdalraster::ogr_layer_delete
to delete multiple layers
path_gpkg <- "/Users/airvine/Projects/gis/rfp_test/background_layers.gpkg"
layers_remove <- c("whse_land_and_natural_resource.prot_historical_fire_polys_sp", "whse_basemapping.fwa_lakes_poly")
purrr::map(layers_remove, ~ gdalraster::ogr_layer_delete(path_gpkg, .x))
Basically each element in the layers_remove
list is passed to gdalraster::ogr_layer_delete()
as .x
with path_gpkg
staying specified as the dsn
param... each time
Fresh function in
gdalraster
(june 2024) seems to work great and when installed withcran
does not require seperate install ofgdal
and does not rewrite the geopackage. much simpler solution