osrm backend controller?
Hi there!
Although the package has worked perfectly well without a backend controller for years, I think now is a great time to add one. My proposal is to provide a set of wrapper functions around the OSRM backend tools such as extract, customize, partition(), routed, so that R users can invoke them seamlessly, assuming those binaries are installed locally. We could even offer analogous controllers for a Docker‐based setup, if a user has Docker up and running.
So it would be similar to https://github.com/symbolrush/osrmr/blob/master/R/OSRMR.R , but I suggest to follow the more modern pattern used in rosmium https://github.com/ipeaGIT/rosmium/blob/main/R/tags_filter.R by leveraging the processx package for robust, cross‐platform process management.
If this sounds useful, I’d be happy to draft a pull request outlining the API and implementation details. Let me know.
Thank you for your suggestion.
We thought about this for the valh package and decided in favor of an explanatory vignette.
https://cran.r-project.org/web/packages/valh/vignettes/install-valhalla.html
Installing the OSRM server isn't always that easy (with or without docker)(see https://rcarto.github.io/posts/build_osrm_server/ for instances on large areas). I prefer to leave the installation and preparation steps outside the package, outside R itself.
That being said, I would gladly consider a PR for a vignette.
That being said, I would gladly consider a PR for a vignette.
Good, I will consider that.
I prefer to leave the installation and preparation steps outside the package, outside R itself.
Yesterday I drafted up a few functions to wrap graph building and running/stopping the server in https://github.com/e-kotov/osrm/tree/backend-control/R that I already use for my own work. As you do not want this functionality in osrm, I would perhaps make a separate package to host these functions, something like osrmb (b for Backend) or osrmd (d for Daemon or routeD), or with a similar name.
The standalone {osrm.backend} package is here! I don't think it can get easier than running just one command on any OS: https://www.ekotov.pro/osrm.backend/articles/osrm-backend.html
I will cleanup the code in the coming weeks and get it ready for CRAN, but I don't expect any major changes. Tested with 5.27.1 and latest v6 releases of OSRM.
One thing you could do in {osrm}, is maybe to implement check for option osrm.backend.local.server and maybe use it by default if it is set, or something like that, so that the integration is even smoother. In the vignette I currently advise to set options("osrm.server" = "http://localhost:5001/"). I could set the option in osrm_start(), but that is a bad practice to set other package's option and I'm not sure that would pass CRAN checks.
it is now CRANned https://cran.r-project.org/package=osrm.backend