0

Ok so in my angular app I am working on the frontend I have two dropdown in which I specify the city of departure and arrival and the backend uses an api that calculates the coordinates of this two inputs and saves them using leaflet and openstreet map I was able to display what I have stored in DB as a straight line which was not pretty so searching for a way to display them snapped to road I found OSRM leaflet-routing-machine which works great but every time I go to my component for visualizing my lines/paths the console shows this enter image description here and while searching I found out by many others that you have to set up you own "set up instance of OSRM" but do I really need to do that just for displaying snaped to read lines ? Or is there a more convenient way? This is the code I am using for the demos servers I guess which I'm afraid will stop working at a given moment:

L.Routing.control({
      router: L.Routing.osrmv1({
        serviceUrl: `http://router.project-osrm.org/route/v1/`
      }),

      plan: L.Routing.plan(waypoints, {
        createMarker: (i, wp) => {
          return L.marker(wp.latLng, {
            draggable: false
          });
        }
      }),
      waypoints: waypoints,
      routeWhileDragging: false,
      addWaypoints : false, //disable adding new waypoints to the existing path
      show: false,


    }).addTo(this.map);
1
  • Thank you for your reply just a quick follow up question say I set up an instance of OSRM on my pc and reference it on my code when I build my project and run my application will it work I mean as long as the pc I have set up my instance is on sorry if this sounds like a stupid or obvious one but this is the first time I am using OSRM and to set it up I have to work with docker which is something I haven't worked either so I'm new to many things in this case :')
    – manga boy
    Commented May 26, 2022 at 14:19

1 Answer 1

0

To whoever/whomever which one is the correct way to use has been struggling with finding an appropriate way to install an instance of OSRM in you machine/pc/server I will refer with the link that helped me out installing it on my pc(windows 11 OS) and successfully using it without displaying the warning on the console:

https://phabi.ch/2020/05/06/run-osrm-in-docker-on-windows/

side note you need to have Docker Desktop installed on you pc make the right configuration to docker desktop and as the link above suggests: Add the path to the docker binary to your system environment’s path variable. Hope this helps it sure helped me.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 27, 2022 at 14:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.