-
Notifications
You must be signed in to change notification settings - Fork 66
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
change default url #369
change default url #369
Conversation
the reason to make such change is we can easily build the graphhopper and run it on local. In local, we may not have such path. For example the default one is localhost:8989/route without /api/1, making this change will make using local graphhopper much easier (in fact may people use it on local, otherwise google or osm is better, one big the reason to run graphhopper is it can be deployed in local)
Hi @hxd1011 many thanks for the PR! I aim to test this and merge/feedback later today. |
Thanks for the change, I can confirm that this works! I've made a slight change to the function based on tests (your version still had issues). See here: #370 |
@hxd1011 can you please test on the latest version? This is the output I get (it works): remotes::install_github("ropensci/stplanr", "hxd1011-patch-1")
library(stplanr)
example(route_graphhopper, run.dontrun = TRUE)
remotes::install_github("ropensci/stplanr", "hxd1011-patch-1")
#> Skipping install of 'stplanr' from a github remote, the SHA1 (655ec38c) has not changed since last install.
#> Use `force = TRUE` to force installation
library(stplanr)
example(route_graphhopper, run.dontrun = TRUE)
#>
#> rt_grp> from <- c(-0.12, 51.5)
#>
#> rt_grp> to <- c(-0.14, 51.5)
#>
#> rt_grp> r1 <- route_graphhopper(from = from, to = to, silent = FALSE)
#> [1] "The request sent was: https://graphhopper.com/api/1/route?point=51.5%2C-0.12&point=51.5%2C-0.14&vehicle=bike&locale=en-US&debug=true&points_encoded=false&key=your-api-key"
#>
#> rt_grp> r2 <- route_graphhopper(from = from, to = to, silent = FALSE, vehicle = "foot")
#> [1] "The request sent was: https://graphhopper.com/api/1/route?point=51.5%2C-0.12&point=51.5%2C-0.14&vehicle=foot&locale=en-US&debug=true&points_encoded=false&key=your-api-key"
#>
#> rt_grp> r3 <- route_graphhopper(from = from, to = to, silent = FALSE, vehicle = "car")
#> [1] "The request sent was: https://graphhopper.com/api/1/route?point=51.5%2C-0.12&point=51.5%2C-0.14&vehicle=car&locale=en-US&debug=true&points_encoded=false&key=your-api-key"
#>
#> rt_grp> plot(r1) #> Created on 2019-11-28 by the reprex package (v0.3.0) Session infodevtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.1 (2019-07-05)
#> os Ubuntu 18.04.3 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 2019-11-28
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.6.0)
#> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
#> callr 3.3.2 2019-09-22 [1] CRAN (R 3.6.1)
#> cli 1.1.0 2019-03-19 [2] CRAN (R 3.5.3)
#> codetools 0.2-16 2018-12-24 [4] CRAN (R 3.5.2)
#> crayon 1.3.4 2017-09-16 [2] standard (@1.3.4)
#> curl 4.2 2019-09-24 [1] CRAN (R 3.6.1)
#> desc 1.2.0 2018-05-01 [2] standard (@1.2.0)
#> devtools 2.2.1 2019-09-24 [1] CRAN (R 3.6.1)
#> digest 0.6.23 2019-11-23 [1] CRAN (R 3.6.1)
#> dplyr 0.8.3 2019-07-04 [2] CRAN (R 3.6.1)
#> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
#> evaluate 0.14 2019-05-28 [2] CRAN (R 3.6.0)
#> foreign 0.8-72 2019-08-02 [2] CRAN (R 3.6.1)
#> fs 1.3.1 2019-05-06 [2] CRAN (R 3.6.0)
#> geosphere 1.5-10 2019-05-26 [2] CRAN (R 3.6.0)
#> glue 1.3.1 2019-03-12 [2] CRAN (R 3.5.3)
#> highr 0.8 2019-03-20 [3] CRAN (R 3.5.3)
#> htmltools 0.4.0 2019-10-04 [3] CRAN (R 3.6.1)
#> httr 1.4.1 2019-08-05 [2] CRAN (R 3.6.1)
#> igraph 1.2.4.2 2019-11-27 [1] CRAN (R 3.6.1)
#> jsonlite 1.6 2018-12-07 [2] standard (@1.6)
#> knitr 1.26 2019-11-12 [1] CRAN (R 3.6.1)
#> lattice 0.20-38 2018-11-04 [2] standard (@0.20-38)
#> magrittr 1.5 2014-11-22 [2] CRAN (R 3.5.2)
#> maptools 0.9-8 2019-10-05 [1] CRAN (R 3.6.1)
#> memoise 1.1.0 2017-04-21 [3] CRAN (R 3.5.0)
#> mime 0.7 2019-06-11 [1] CRAN (R 3.6.0)
#> openxlsx 4.1.3 2019-11-07 [1] CRAN (R 3.6.1)
#> pillar 1.4.2 2019-06-29 [2] CRAN (R 3.6.0)
#> pkgbuild 1.0.6 2019-10-09 [2] CRAN (R 3.6.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
#> pkgload 1.0.2 2018-10-29 [3] CRAN (R 3.5.1)
#> prettyunits 1.0.2 2015-07-13 [2] CRAN (R 3.5.3)
#> processx 3.4.1 2019-07-18 [2] CRAN (R 3.6.1)
#> ps 1.3.0 2018-12-21 [2] CRAN (R 3.5.3)
#> purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.1)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.1)
#> raster 3.0-7 2019-09-24 [1] CRAN (R 3.6.1)
#> Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.1)
#> remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.1)
#> rgdal 1.4-8 2019-11-27 [1] CRAN (R 3.6.1)
#> rgeos 0.5-2 2019-10-03 [1] CRAN (R 3.6.1)
#> rlang 0.4.2 2019-11-23 [1] CRAN (R 3.6.1)
#> rmarkdown 1.18 2019-11-27 [1] CRAN (R 3.6.1)
#> rprojroot 1.3-2 2018-01-03 [2] CRAN (R 3.5.3)
#> sessioninfo 1.1.1 2018-11-05 [3] CRAN (R 3.5.1)
#> sp 1.3-2 2019-11-07 [1] CRAN (R 3.6.1)
#> stplanr * 0.4.1.9000 2019-11-28 [1] Github (ropensci/stplanr@655ec38)
#> stringi 1.4.3 2019-03-12 [2] CRAN (R 3.5.3)
#> stringr 1.4.0 2019-02-10 [2] standard (@1.4.0)
#> testthat 2.3.0 2019-11-05 [2] CRAN (R 3.6.1)
#> tibble 2.1.3 2019-06-06 [2] CRAN (R 3.6.0)
#> tidyselect 0.2.5 2018-10-11 [2] CRAN (R 3.5.3)
#> usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.1)
#> withr 2.1.2 2018-03-15 [2] CRAN (R 3.5.3)
#> xfun 0.11 2019-11-12 [1] CRAN (R 3.6.1)
#> xml2 1.2.2 2019-08-09 [3] CRAN (R 3.6.1)
#> yaml 2.2.0 2018-07-25 [3] CRAN (R 3.5.1)
#> zip 2.0.4 2019-09-01 [2] CRAN (R 3.6.1)
#>
#> [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 |
Confirmed: I got an error on previous version
|
Hi, @Robinlovelace Thank you very much for the work!. I really liked your book Geocomputation with R. When I wrote this PR, I was in middle of some work and when I go back to my comment, it is really repetitive and has little value. Thanks for the merge and doing all of the work. |
Many thanks for the contribution @hxd1011. Any further feedback (especially in the form of reproducible issues or PR ; ) will be greatly appreciated. Please confirm that the new implementation works, and let me know of further thoughts (there are other things we could do, including splitting out the |
the reason to make such change is we can easily build the graphhopper and run it on local. In local, we may not have such path.
For example the default one is localhost:8989/route
without /api/1, making this change will make using local graphhopper much easier
(in fact may people use it on local, otherwise google or osm is better, one big the reason to run graphhopper is it can be deployed in local)