Closed JimShady closed 5 years ago
I would also like to ask a question regarding to vehicle routing.
How can I plot vehicle track on a map in R. I have the coordinates of several locations but I would like to plot the track from a destination, touching all other locations and returning to the same origin.
If you have an idea on how to get this done. Kindly reply.
Thanks
Hi @JimShady and @Anyaoha these are good questions. You can create routes with a variety of route_()
functions, that will return spatial data objects. However, as you point-out, these are not feature complete. A bit of history may be useful here: stplanr was originally developed to deliver a web app for contract with the DfT, and only contained the function route_cyclestreets()
. Since then things have developed substantially. We have the sf
package. And, having learned about the the concept of modularity in software design, have started to split-out packages from stplanr
to make it less monolithic.
Three examples of split-out packages are:
There are many packages providing R interfaces to routing services. I suggest taking a look here for more information: https://geocompr.robinlovelace.net/transport.html#routes
It's very useful to have this issue open because it provides a motivation to finish the refactoring work. When it is finished I envision the route()
function being a high-level wrapper to a range of routing services, local and remote. Any input into that process very welcome. Thanks, and please let us know how you get on.
Thanks @Robinlovelace .
Thanks @Robinlovelace I would use this to experiment on plotting tracks for the road network. It is interesting to see a lot of work being done in the routing network domain. Please keep me posted if you find out a code that plots track on road networks touching all coordinates assigned.
@Anyaoha -- I think you are talking about the 'travelling salesman' routing algorithm. I'm just googling trying to find an implementation of it in R for you but struggling. Do you know of one @mpadge ?
This looks like what you need @Anyaoha : https://www.r-bloggers.com/travelling-salesman-with-ggmap/
@JimShady no I don't but I would check the @mpadge out. I quickly went through the ropensci/osmplotr I found there but it wasn't helpful. I am glad you're helpful.
@JimShady wow. Thanks I would implement that and see how it goes. My dataset just has about 600 coordinates which I want to see if I can cluster them in pairs and plot routes for each. After which I would have to optimize the original route to find out the shortest route distance of each. I would try out this which you have helped me out with. Anyways my eyes would still be open to receive more help. Thanks a bunch!
For the specific question, I think what you need is this (or the new transportAPI package listed above, or an OTP-based approach - @mem48 is working on that also): https://github.com/ATFutures/gtfs-router by @mpadge
For the broader question of updating routing capabilities, stplanr could be a useful metapackage to host a range of transport planning tools, some of which use other packages, is my thinking.
Closing this issue for now in any case. Great discussion.
Hi Robin,
I was wondering if there is data in the background of the
route_transportapi_public
that is being discarded, and which could be returned to the user? For instance could the bus numbers / segments be returned within this query?Thanks, James