Skip to content

Instantly share code, notes, and snippets.

@agila5
Created November 12, 2021 16:20
Show Gist options
  • Save agila5/ab2445e0cb5d148accb8e423dc63d2b1 to your computer and use it in GitHub Desktop.
Save agila5/ab2445e0cb5d148accb8e423dc63d2b1 to your computer and use it in GitHub Desktop.
# get data
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.
munich_multilines <- oe_get(
  place = "Muenches", 
  layer = "multilinestrings", 
  provider = "bbbike", 
  extra_tags = "route"
)
#> The input place was matched with: Muenchen
#> The chosen file was already detected in the download directory. Skip downloading.
#> The corresponding gpkg file was already detected. Skip vectortranslate operations.
#> Reading layer `multilinestrings' from data source 
#>   `C:\Users\andrea.gilardi\Documents\osm-data\bbbike_Muenchen.gpkg' 
#>   using driver `GPKG'
#> Simple feature collection with 3467 features and 5 fields
#> Geometry type: MULTILINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 11.06001 ymin: 47.8 xmax: 11.99999 ymax: 48.42
#> Geodetic CRS:  WGS 84

# plot
library(tmap)
#> Registered S3 methods overwritten by 'stars':
#>   method             from
#>   st_bbox.SpatRaster sf  
#>   st_crs.SpatRaster  sf
tm_shape(munich_multilines) + 
  tm_lines(col = "route", palette = "Set2") + 
  tm_layout(legend.outside = TRUE)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment