0

If a round trip is compiled with the Leaflet Routing Machine and lrm-openroutservice, this is not fired as the Leaflet Routing Machine requires a start and an end point => two waypoint.

openrouteservice.org can find a route with the round-trip attribute. Only one waypoint may be specified as the end point is the starting point. The lenght attribute specifies the approximate length of the route. OSR then searches for a route. If seed is also specified, the route for each sed setting between 1 ... 50 is chosen randomly... A perfect tool for hikes or bike tours etc... OSR API Spec.

var router = L.Routing.control({
            waypoints: [
                L.latLng(48.12, 8.22)
            ],
            router: new L.Routing.OpenRouteService(apikey, {
                "timeout": 45 * 1000,
                "format": "json",
                "host": "https://api.openrouteservice.org",
                "service": "directions",
                "api_version": "v2",
                "profile": "driving-car",
                "routingQueryParams": {
                    "options": {
                        "round_trip": {
                            "length": 10000,
                            "points": 3,
                        }
                    }
                }
            }),
        }).addTo(map);

What can I do to ensure that the Leaflet Routing Machine also starts a request with one waypoint for the round-trip attribute?

Round Trip Example

10
  • This is not clear. If you want to get round trip with only one point and no other data, there is almost infinite number of round trips, unless you are on a road segment that is isolated.
    – TomazicM
    Commented Apr 6 at 8:46
  • Yes, openrouteservice.org can find a route with the round-trip attribute. only one waypoint may be specified as the end point is the starting point. the lenght attribute specifies the approximate length of the route. OSR then searches for a route. If seed is also specified, the route for each sed setting between 1 ... 50 is chosen randomly... A perfect tool for hikes or bike tours etc... OSR API Spec.
    – Severin
    Commented Apr 6 at 10:10
  • @TomazicM The length of the rout is the limiter and seed is the random for the rout.
    – Severin
    Commented Apr 6 at 10:17
  • Did you manage to make it work with two points? I didn't.
    – TomazicM
    Commented Apr 8 at 9:38
  • The OSR service 'round-trip' only works with one waypoint... I have not yet been able to get the leaflet routing machine to start a request with only one waypoint
    – Severin
    Commented Apr 9 at 3:19

0

Your Answer

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

Browse other questions tagged or ask your own question.