Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oe_get could import partial OSM extracts without raising warning or messages #181

Open
agila5 opened this issue Mar 19, 2021 · 0 comments
Open
Assignees

Comments

@agila5
Copy link
Collaborator

agila5 commented Mar 19, 2021

Consider the following 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.
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1

Import Greater London road network considering only primary, secondary, and tertiary highways

greater_london <- oe_get(
  place = "Greater London", 
  vectortranslate_options = c(
    "-f", "GPKG", 
    "-overwrite", 
    "-where", "highway IN ('primary', 'secondary', 'tertiary')",
    "lines"
  )
)
#> The input place was matched with: Greater London
#> The chosen file was already detected in the download directory. Skip downloading.
#> Start with the vectortranslate operations on the input file!
#> 0...10...20...30...40...50...60...70...80...90...100 - done.
#> Finished the vectortranslate operations on the input file!
#> Reading layer `lines' from data source `C:\Users\Utente\Documents\osm-data\geofabrik_greater-london-latest.gpkg' using driver `GPKG'
#> Simple feature collection with 27950 features and 9 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -0.5102405 ymin: 51.28324 xmax: 0.3308773 ymax: 51.69751
#> Geodetic CRS:  WGS 84

Then, after a few weeks, I forget about the vectortranslate query and import Greater London data again:

oe_get("Greater London")
#> The input place was matched with: Greater London
#> The chosen file was already detected in the download directory. Skip downloading.
#> The corresponding gpkg file was already detected. Skip vectortranslate operations.
#> Reading layer `lines' from data source `C:\Users\Utente\Documents\osm-data\geofabrik_greater-london-latest.gpkg' using driver `GPKG'
#> Simple feature collection with 27950 features and 9 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -0.5102405 ymin: 51.28324 xmax: 0.3308773 ymax: 51.69751
#> Geodetic CRS:  WGS 84

The vectortranslate conversion is skipped, and oe_get imports the OSM data that were filtered during the previous call to oe_get().

I think that we can implement the following solution. Create a hidden folder within the download_directory with several .txt files that flag if a particular OSM extract was converted using ad-hoc vectortranslate options.

@agila5 agila5 self-assigned this Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant