# NOT RUN {
# Download OSM extracts associated to a simple test.
its = oe_get("ITS Leeds", quiet = FALSE)
class(its)
unique(sf::st_geometry_type(its))
# Get another layer from the test extract
its_points = oe_get("ITS Leeds", layer = "points")
unique(sf::st_geometry_type(its_points))
# Get the .osm.pbf and .gpkg file path
oe_get("ITS Leeds", download_only = TRUE)
oe_get("ITS Leeds", download_only = TRUE, skip_vectortranslate = TRUE)
# See also ?oe_find()
# Add additional tags
its_with_oneway = oe_get("ITS Leeds", extra_tags = "oneway", quiet = FALSE)
names(its_with_oneway)
table(its_with_oneway$oneway, useNA = "ifany")
# Use the query argument to get only oneway streets:
q = "SELECT * FROM 'lines' WHERE oneway IN ('yes')"
its_oneway = oe_get("ITS Leeds", query = q)
its_oneway
# }
# NOT RUN {
# A more complex example
west_yorkshire = oe_get("West Yorkshire", quiet = FALSE)
# If you run it again, the function will not download the file
# or convert it again
west_yorkshire = oe_get("West Yorkshire", quiet = FALSE)
# Match with place name
oe_get("Milan") # Warning: the .pbf file is 400MB
oe_get("Vatican City")
oe_get("Zurich")
# Match with coordinates (any EPSG)
milan_duomo = sf::st_sfc(sf::st_point(c(1514924, 5034552)), crs = 3003)
oe_get(milan_duomo, quiet = FALSE) # Warning: the .pbf file is 400MB
# Match with numeric coordinates (EPSG = 4326)
oe_match(c(9.1916, 45.4650), quiet = FALSE)
# Alternative providers
baku = oe_get(place = "Baku", provider = "bbbike", quiet = FALSE)
# Other examples:
oe_get("RU", match_by = "iso3166_1_alpha2", quiet = FALSE)
# The following example mimics read_sf
oe_get("Andora", stringsAsFactors = FALSE, quiet = TRUE, as_tibble = TRUE)
# }
Run the code above in your browser using DataLab