ropensci/osmextract

[BUG] Motorways included in cycle networks

joeytalbot opened this issue · 3 comments

The documentation for oe_get_network() states that for "cycling":

The highway tag is not equal to motorway, motorway_link, footway, bridleway or pedestrian unless the tag bicycle is equal to yes

However the results include highways tagged "motoway" and "motorway_link", which are not tagged "bicycle=yes"

library(tidyverse)
 osm_lines = osmextract::oe_get_network(
   place = "Tyne and Wear",
   mode = "cycling"
 )
#> The input place was matched with: Tyne and Wear
#> File downloaded!
#> 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 
#>   `/tmp/RtmpJPTBDa/geofabrik_tyne-and-wear-latest.gpkg' using driver `GPKG'
#> Simple feature collection with 76013 features and 12 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -3.46763 ymin: 50.66462 xmax: -1.343631 ymax: 55.08401
#> Geodetic CRS:  WGS 84
motorway = osm_lines %>%
   filter(highway == "motorway") %>%
   filter(is.na(bicycle))
motorway_link = osm_lines %>%
   filter(highway == "motorway_link") %>%
   filter(is.na(bicycle))
dim(motorway)
#> [1] 76 13
dim(motorway_link)
#> [1] 79 13
Created on 2023-01-11 with [reprex v2.0.2](https://reprex.tidyverse.org/)

Hi @joeytalbot. Are you sure that you are using the last version of the package? I see no error.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
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.
osm_lines = oe_get_network(
  place = "Tyne and Wear",
  mode = "cycling"
)
#> The input place was matched with: Tyne and Wear
#> The chosen file was already detected in the download directory. Skip downloading.
#> Starting 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 
#>   `D:\osm-data\geofabrik_tyne-and-wear-latest.gpkg' using driver `GPKG'
#> Simple feature collection with 59159 features and 12 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -1.878213 ymin: 54.79363 xmax: -1.346884 ymax: 55.08401
#> Geodetic CRS:  WGS 84
filter(osm_lines, highway == "motorway")
#> Simple feature collection with 0 features and 12 fields
#> Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS:  WGS 84
#>  [1] osm_id     name       highway    waterway   aerialway  barrier   
#>  [7] man_made   access     bicycle    service    z_order    other_tags
#> [13] geometry  
#> <0 rows> (or 0-length row.names)
filter(osm_lines, highway == "motorway_link")
#> Simple feature collection with 0 features and 12 fields
#> Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS:  WGS 84
#>  [1] osm_id     name       highway    waterway   aerialway  barrier   
#>  [7] man_made   access     bicycle    service    z_order    other_tags
#> [13] geometry  
#> <0 rows> (or 0-length row.names)

Created on 2023-01-12 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value
#>  version  R version 4.1.3 (2022-03-10)
#>  os       Windows 10 x64 (build 19044)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  English_United Kingdom.1252
#>  ctype    English_United Kingdom.1252
#>  tz       Europe/Berlin
#>  date     2023-01-12
#>  pandoc   2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date (UTC) lib source
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.1.3)
#>  class         7.3-20     2022-01-16 [2] CRAN (R 4.1.3)
#>  classInt      0.4-8      2022-09-29 [1] CRAN (R 4.1.3)
#>  cli           3.6.0      2023-01-09 [1] CRAN (R 4.1.3)
#>  DBI           1.1.3      2022-06-18 [1] CRAN (R 4.1.3)
#>  digest        0.6.31     2022-12-11 [1] CRAN (R 4.1.3)
#>  dplyr       * 1.0.10     2022-09-01 [1] CRAN (R 4.1.3)
#>  e1071         1.7-12     2022-10-24 [1] CRAN (R 4.1.3)
#>  evaluate      0.19       2022-12-13 [1] CRAN (R 4.1.3)
#>  fansi         1.0.3      2022-03-24 [1] CRAN (R 4.1.3)
#>  fastmap       1.1.0      2021-01-25 [1] CRAN (R 4.1.3)
#>  fs            1.5.2      2021-12-08 [1] CRAN (R 4.1.3)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.1.3)
#>  glue          1.6.2      2022-02-24 [1] CRAN (R 4.1.3)
#>  highr         0.10       2022-12-22 [1] CRAN (R 4.1.3)
#>  htmltools     0.5.4      2022-12-07 [1] CRAN (R 4.1.3)
#>  KernSmooth    2.23-20    2021-05-03 [2] CRAN (R 4.1.3)
#>  knitr         1.41       2022-11-18 [1] CRAN (R 4.1.3)
#>  lifecycle     1.0.3      2022-10-07 [1] CRAN (R 4.1.3)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.1.3)
#>  osmextract  * 0.4.1.9000 2022-09-03 [1] local
#>  pillar        1.8.1      2022-08-19 [1] CRAN (R 4.1.3)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.1.3)
#>  proxy         0.4-27     2022-06-09 [1] CRAN (R 4.1.3)
#>  purrr         1.0.1      2023-01-10 [1] CRAN (R 4.1.3)
#>  R.cache       0.16.0     2022-07-21 [1] CRAN (R 4.1.3)
#>  R.methodsS3   1.8.2      2022-06-13 [1] CRAN (R 4.1.3)
#>  R.oo          1.25.0     2022-06-12 [1] CRAN (R 4.1.3)
#>  R.utils       2.12.2     2022-11-11 [1] CRAN (R 4.1.3)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.1.3)
#>  Rcpp          1.0.9      2022-07-08 [1] CRAN (R 4.1.3)
#>  reprex        2.0.2      2022-08-17 [1] CRAN (R 4.1.3)
#>  rlang         1.0.6      2022-09-24 [1] CRAN (R 4.1.3)
#>  rmarkdown     2.19       2022-12-15 [1] CRAN (R 4.1.3)
#>  rstudioapi    0.14       2022-08-22 [1] CRAN (R 4.1.3)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.1.3)
#>  sf            1.0-9      2022-11-08 [1] CRAN (R 4.1.3)
#>  stringi       1.7.12     2023-01-11 [1] CRAN (R 4.1.3)
#>  stringr       1.5.0      2022-12-02 [1] CRAN (R 4.1.3)
#>  styler        1.8.1      2022-11-07 [1] CRAN (R 4.1.3)
#>  tibble        3.1.8      2022-07-22 [1] CRAN (R 4.1.3)
#>  tidyselect    1.2.0      2022-10-10 [1] CRAN (R 4.1.3)
#>  units         0.8-1      2022-12-10 [1] CRAN (R 4.1.3)
#>  utf8          1.2.2      2021-07-24 [1] CRAN (R 4.1.3)
#>  vctrs         0.5.1      2022-11-16 [1] CRAN (R 4.1.3)
#>  withr         2.5.0      2022-03-03 [1] CRAN (R 4.1.3)
#>  xfun          0.36       2022-12-21 [1] CRAN (R 4.1.3)
#>  yaml          2.3.6      2022-10-18 [1] CRAN (R 4.1.3)
#> 
#>  [1] C:/Users/Andrea Gilardi/Documents/R/win-library/4.1
#>  [2] C:/Program Files/R/R-4.1.3/library
#> 
#> ------------------------------------------------------------------------------

Hi @agila5 I had osmextract v0.4.1 which I thought was the latest version, but now I've installed v0.4.1.9000 and it doesn't include motorways in the cycle routing! Thank you :)

You're welcome! Anyway, it's not your fault and I will work on a new release really soon.