NewGraphEnvironment / rfp

Reproducible Field Projects British Columbia
Other
0 stars 0 forks source link

check for `gdal` installation in `rfp_u_rm_gpkg_layers` and mark function as superceded pointing to `gdalraster::ogr_layer_delete()`` as a simpler alternative #7

Closed NewGraphEnvironment closed 2 months ago

NewGraphEnvironment commented 2 months ago

Fresh function in gdalraster (june 2024) seems to work great and when installed with cran does not require seperate install of gdal and does not rewrite the geopackage. much simpler solution

NewGraphEnvironment commented 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