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 ?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.