osmextract icon indicating copy to clipboard operation
osmextract copied to clipboard

Add remove_gpkg argument

Open agila5 opened this issue 2 years ago • 0 comments

First tests with remove_gpkg argument, see #235. I think that, at the moment, the only problem is that the function removes existing gpkg files. For example:

# packages
library(osmextract)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright.
#> Check the package website, https://docs.ropensci.org/osmextract/, for more details.
options("sf_max_print" = 0L)

# data
pbf_path <- system.file("its-example.osm.pbf", package = "osmextract")

# new behaviour
oe_read(pbf_path, remove_gpkg = TRUE, quiet = TRUE)
list.files(system.file(package = "osmextract"), "pbf|gpkg")
#> [1] "its-example.osm.pbf"

# default behaviour
oe_read(pbf_path, quiet = TRUE)
list.files(system.file(package = "osmextract"), "pbf|gpkg")
#> [1] "its-example.gpkg"    "its-example.osm.pbf"

# problem
oe_read(pbf_path, remove_gpkg = TRUE, quiet = TRUE)
list.files(system.file(package = "osmextract"), "pbf|gpkg")
#> [1] "its-example.osm.pbf"

Created on 2021-12-01 by the reprex package (v2.0.1)

TODO: add examples and tests

agila5 avatar Dec 01 '21 11:12 agila5