Is it possible to create a route with intermediate stops points (apart from A to B) in R?

117 views Asked by At

The code below was shared in the stplanr documentation : stplanr documentation

library(stplanr)
    library(osrm)
    trip <- route(
      from = c(-0.11, 51.514),
      to = c(-0.10, 51.506),
      route_fun = osrmRoute,
      returnclass = "sf"
      )

The above code has from and to nodes in it. Is it possible to find a route with more than 2 points (meaning intermediate stops) ? Please help me find this solution. Solutions apart from stplanr package is also welcome.

I have a set of lat long points as shown below:

points <-tribble (
  ~x,~y, ~order,
  78.14358, 9.921388,1,         
78.14519,   9.921123,2,         
78.14889,   9.916954,3,         
78.14932,   9.912807,4,         
78.14346,   9.913828,5,         
78.13490,   9.916551,6,         
78.12904,   9.918782,7  
)

I want an output like this :

Expected output

Thanks a lot.

0

There are 0 answers