1

I currently have a leaflet implementation that uses L.Routing.OSRMv1, and it allows me to get a route, modify it on the fly with waypoints, and then save it as a trip. This works fine, current implementation looks like that :

  var control = L.Routing.control({
    routeWhileDragging: true,
    plan: plan,
      show: true,
    router: L.Routing.osrmv1({serviceUrl: routerurl, profile: 'train', useHints: false})
      });

Now, I would like to implement editing of already saved trips. So basically, I would like to to bypass the initial routing by feeding my saved path instead, and keep being able to move start and end points.

I thought about replacing this._selectedRoute.coordinates with my saved path, but it seems hacky and suboptimal.

Is this possible to do in a better way ?

Sim
  • 45
  • 1
  • 7

1 Answers1

0

Can't you pass your route as a polyline with your GET request? According to the documentation, you can use either coordinate to get directions or a polyline (which is your pre-existing route) source: http://project-osrm.org/docs/v5.5.1/api/#general-options