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

object 'route_osrm' not found #486

Closed
Nowosad opened this issue Apr 4, 2020 · 2 comments
Closed

object 'route_osrm' not found #486

Nowosad opened this issue Apr 4, 2020 · 2 comments
Assignees

Comments

@Nowosad
Copy link
Member

Nowosad commented Apr 4, 2020

@Robinlovelace , I've got an email about the issue presented below - can you take a look at it?

library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0
library(dplyr)
library(spDataLarge)
library(stplanr)      # geographic transport data package
library(tmap)         # visualization package (see Chapter 8)

zones_attr = bristol_od %>%
        group_by(o) %>%
        summarize_if(is.numeric, sum) %>%
        dplyr::rename(geo_code = o)


zones_joined = left_join(bristol_zones, zones_attr, by = "geo_code")

zones_od = bristol_od %>%
        group_by(d) %>%
        summarize_if(is.numeric, sum) %>%
        dplyr::select(geo_code = d, all_dest = all) %>%
        inner_join(zones_joined, ., by = "geo_code")


od_intra = filter(bristol_od, o == d)
od_inter = filter(bristol_od, o != d)

desire_lines = od2line(od_inter, zones_od)
#> Creating centroids representing desire line start and end points.

desire_lines$distance = as.numeric(st_length(desire_lines))
desire_carshort = dplyr::filter(desire_lines, car_driver > 300 & distance < 5000)

route_carshort = line2route(desire_carshort, route_fun = route_osrm)
#> Error in match.fun(route_fun): object 'route_osrm' not found

Created on 2020-04-04 by the reprex package (v0.3.0)

@Robinlovelace Robinlovelace self-assigned this Apr 4, 2020
@Robinlovelace
Copy link
Collaborator

This is caused by changes in stplanr. I will take a look and fix for the latest (or next) version.

Robinlovelace added a commit that referenced this issue Apr 4, 2020
@Robinlovelace
Copy link
Collaborator

I think #487 fixes the issue. Reprex with updated code in that PR that is ready to merge I think (ready to merge pending review):

library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0
    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(spDataLarge)
    library(stplanr)      # geographic transport data package
    library(tmap)         # visualization package (see Chapter 8)
    
    zones_attr = bristol_od %>%
        group_by(o) %>%
        summarize_if(is.numeric, sum) %>%
        dplyr::rename(geo_code = o)
    
    
    zones_joined = left_join(bristol_zones, zones_attr, by = "geo_code")
    
    zones_od = bristol_od %>%
        group_by(d) %>%
        summarize_if(is.numeric, sum) %>%
        dplyr::select(geo_code = d, all_dest = all) %>%
        inner_join(zones_joined, ., by = "geo_code")
    
    
    od_intra = filter(bristol_od, o == d)
    od_inter = filter(bristol_od, o != d)
    
    desire_lines = od2line(od_inter, zones_od)
#> Creating centroids representing desire line start and end points.
    
    desire_lines$distance = as.numeric(st_length(desire_lines))
    desire_carshort = dplyr::filter(desire_lines, car_driver > 300 & distance < 5000)
    
    library(osrm)
#> Data: (c) OpenStreetMap contributors, ODbL 1.0 - http://www.openstreetmap.org/copyright
#> Routing: OSRM - http://project-osrm.org/
    route_carshort = route(
        l = desire_carshort,
        route_fun = osrmRoute,
        returnclass = "sf" # argument passed to route_fun
    )
#> Most common output is sf
    plot(route_carshort)
#> Warning: plotting the first 9 out of 13 attributes; use max.plot = 13 to plot
#> all

Created on 2020-04-04 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.3 (2020-02-29)
#>  os       Ubuntu 18.04.4 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_GB:en                    
#>  collate  en_GB.UTF-8                 
#>  ctype    en_GB.UTF-8                 
#>  tz       Europe/London               
#>  date     2020-04-04                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version      date       lib
#>  abind          1.4-5        2016-07-21 [2]
#>  assertthat     0.2.1        2019-03-21 [2]
#>  backports      1.1.5        2019-10-02 [1]
#>  base64enc      0.1-3        2015-07-28 [3]
#>  bitops         1.0-6        2013-08-17 [2]
#>  callr          3.4.2        2020-02-12 [1]
#>  class          7.3-16       2020-03-25 [2]
#>  classInt       0.4-3        2020-03-24 [1]
#>  cli            2.0.2        2020-02-28 [1]
#>  codetools      0.2-16       2018-12-24 [4]
#>  colorspace     1.4-1        2019-03-18 [2]
#>  crayon         1.3.4        2017-09-16 [2]
#>  crosstalk      1.1.0.1      2020-03-13 [2]
#>  curl           4.3          2019-12-02 [2]
#>  DBI            1.1.0        2019-12-15 [2]
#>  desc           1.2.0        2018-05-01 [2]
#>  devtools       2.2.2        2020-02-17 [1]
#>  dichromat      2.0-0        2013-01-24 [2]
#>  digest         0.6.25       2020-02-23 [1]
#>  dplyr        * 0.8.5        2020-03-07 [1]
#>  e1071          1.7-3        2019-11-26 [2]
#>  ellipsis       0.3.0        2019-09-20 [3]
#>  evaluate       0.14         2019-05-28 [2]
#>  fansi          0.4.1        2020-01-08 [1]
#>  foreign        0.8-76       2020-03-03 [2]
#>  fs             1.3.2        2020-03-05 [2]
#>  geosphere      1.5-10       2019-05-26 [2]
#>  gepaf          0.1.1        2018-03-05 [1]
#>  glue           1.3.2        2020-03-12 [2]
#>  highr          0.8          2019-03-20 [3]
#>  htmltools      0.4.0.9003   2020-03-25 [1]
#>  htmlwidgets    1.5.1        2019-10-08 [2]
#>  httr           1.4.1        2019-08-05 [2]
#>  igraph         1.2.5        2020-03-19 [1]
#>  jsonlite       1.6.1        2020-02-02 [1]
#>  KernSmooth     2.23-16      2019-10-15 [4]
#>  knitr          1.28         2020-02-06 [1]
#>  lattice        0.20-40      2020-02-19 [2]
#>  leafem         0.1.0        2020-03-25 [1]
#>  leaflet        2.0.3.9000   2020-01-12 [1]
#>  leafsync       0.1.0        2019-03-05 [1]
#>  lifecycle      0.2.0.9000   2020-03-16 [1]
#>  lwgeom         0.2-2        2020-03-25 [1]
#>  magrittr       1.5          2014-11-22 [2]
#>  maptools       0.9-9        2019-12-01 [1]
#>  memoise        1.1.0        2017-04-21 [3]
#>  mime           0.9          2020-02-04 [1]
#>  munsell        0.5.0        2018-06-12 [3]
#>  osrm         * 3.3.2        2019-09-23 [1]
#>  pbapply        1.4-2        2019-08-31 [2]
#>  pillar         1.4.3        2019-12-20 [1]
#>  pkgbuild       1.0.6        2019-10-09 [2]
#>  pkgconfig      2.0.3        2019-09-22 [2]
#>  pkgload        1.0.2        2018-10-29 [3]
#>  png            0.1-7        2013-12-03 [2]
#>  prettyunits    1.1.1        2020-01-24 [1]
#>  processx       3.4.2        2020-02-09 [2]
#>  ps             1.3.2        2020-02-13 [1]
#>  purrr          0.3.3        2019-10-18 [1]
#>  R6             2.4.1        2019-11-12 [2]
#>  raster         3.0-14       2020-04-02 [1]
#>  RColorBrewer   1.1-2        2014-12-07 [3]
#>  Rcpp           1.0.4        2020-03-17 [1]
#>  RCurl          1.98-1.1     2020-01-19 [2]
#>  remotes        2.1.1        2020-02-15 [1]
#>  rgeos          0.5-2        2019-10-03 [1]
#>  rlang          0.4.5.9000   2020-03-25 [1]
#>  rmarkdown      2.1.1        2020-03-25 [1]
#>  rprojroot      1.3-2        2018-01-03 [2]
#>  scales         1.1.0        2019-11-18 [1]
#>  sessioninfo    1.1.1        2018-11-05 [3]
#>  sf           * 0.9-1        2020-03-27 [1]
#>  sp             1.4-1        2020-02-28 [1]
#>  spDataLarge  * 0.3.1        2020-01-12 [1]
#>  stars          0.4-0        2019-10-10 [2]
#>  stplanr      * 0.5.1.9000   2020-04-04 [1]
#>  stringi        1.4.6        2020-02-17 [1]
#>  stringr        1.4.0        2019-02-10 [2]
#>  testthat       2.3.2        2020-03-02 [1]
#>  tibble         2.99.99.9014 2020-03-27 [1]
#>  tidyselect     1.0.0        2020-01-27 [1]
#>  tmap         * 3.0          2020-03-25 [1]
#>  tmaptools      3.0          2020-03-25 [1]
#>  units          0.6-6        2020-03-16 [1]
#>  usethis        1.5.1.9000   2020-03-27 [1]
#>  vctrs          0.2.99.9010  2020-03-27 [1]
#>  viridisLite    0.3.0        2018-02-01 [3]
#>  withr          2.1.2        2018-03-15 [2]
#>  xfun           0.12         2020-01-13 [1]
#>  XML            3.99-0.3     2020-01-20 [1]
#>  xml2           1.3.0        2020-04-01 [3]
#>  yaml           2.2.1        2020-02-01 [1]
#>  source                              
#>  CRAN (R 3.5.2)                      
#>  CRAN (R 3.6.0)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.5.0)                      
#>  CRAN (R 3.5.3)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.3)                      
#>  Github (r-spatial/classInt@036a85d) 
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.5.2)                      
#>  CRAN (R 3.5.3)                      
#>  standard (@1.3.4)                   
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.2)                      
#>  standard (@1.2.0)                   
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.5.2)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.0)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.0)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.5.3)                      
#>  Github (rstudio/htmltools@1a35072)  
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.2)                      
#>  Github (r-spatial/leafem@5f49400)   
#>  Github (rstudio/leaflet@c19b0fb)    
#>  CRAN (R 3.6.0)                      
#>  Github (r-lib/lifecycle@355dcba)    
#>  Github (r-spatial/lwgeom@8380b04)   
#>  CRAN (R 3.5.2)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.5.0)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.5.0)                      
#>  Github (rCarto/osrm@4c46b76)        
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.5.1)                      
#>  CRAN (R 3.5.2)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.6.1)                      
#>  Github (rspatial/raster@56f961c)    
#>  CRAN (R 3.5.0)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.1)                      
#>  Github (r-lib/rlang@a90b04b)        
#>  Github (rstudio/rmarkdown@947b872)  
#>  CRAN (R 3.5.3)                      
#>  CRAN (R 3.6.1)                      
#>  CRAN (R 3.5.1)                      
#>  Github (r-spatial/sf@69c8d42)       
#>  CRAN (R 3.6.2)                      
#>  Github (nowosad/spDataLarge@1f52612)
#>  CRAN (R 3.6.1)                      
#>  local                               
#>  CRAN (R 3.6.2)                      
#>  standard (@1.4.0)                   
#>  CRAN (R 3.6.3)                      
#>  Github (tidyverse/tibble@3a050ab)   
#>  CRAN (R 3.6.2)                      
#>  Github (mtennekes/tmap@9b5c9c8)     
#>  Github (mtennekes/tmaptools@7b3354f)
#>  CRAN (R 3.6.3)                      
#>  Github (r-lib/usethis@a2c118f)      
#>  Github (r-lib/vctrs@ce16d1c)        
#>  CRAN (R 3.5.0)                      
#>  CRAN (R 3.5.3)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.2)                      
#>  CRAN (R 3.6.3)                      
#>  CRAN (R 3.6.2)                      
#> 
#> [1] /home/robin/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library

Robinlovelace added a commit that referenced this issue Apr 5, 2020
Robinlovelace added a commit to geocompx/geocompkg that referenced this issue Apr 5, 2020
@Nowosad Nowosad closed this as completed in 5522573 Apr 8, 2020
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

2 participants