Node-RED WORLDMAP: Drawing routes/paths based on the coordinates

Hi,

Are there suggestions of anyone who has worked on an api that can help plot routes/paths(shortest etc.) on a worldmap/ openstreetmap using set of two or three geo coordinates?

Thank you in advance!

Best Regards,
Muhammad Rohan Ali Asmat

Not sure what you are trying to do ? The tracks node (part of worldmap) can add a track to any point that gets updated. You can also draw lines if you read the readme.

Hi,

Many thanks for suggestion.
What I mean is that if we have two or three coordinates with start and end point can we get the shortest route?
Even better if we get according to the modes of transport!

The shortest route will be a straight line (or actually the Great Circle line) between the two points.

Are you actually asking that it should understand road layouts and work out the best way to (for example) drive from A to B? If so then the answer is no. You will have to use the likes of Google Navigation for that.

1 Like

Yes, I meant that!

For example, I was looking for if anyone has integrated OSRM are is implementing osrm node!

Not that I know of - but I would look here for plugins that would help - https://leafletjs.com/plugins.html#routing
As (for example) the Routing Machine one is over 500k compressed I'm not about to add it by default but it wouldn't be too hard to do I would hope.

1 Like

Thanks for the pointers!

Hi @dceejay,

I am a kind of newby node-red worldmap (just 3 months), how can I add this Leaflet.Routing https://github.com/Turistforeningen/leaflet-routing plugin to the node-red worldmap palette?

Quick answer is not easily without taking it apart and embedding it.
Notes it is also over 5 years old so may not play so well with latest version of leaflet. But it is mainly a UI to a routing engine. You could potentially use the existing worldmap to add points then a node-red flow to call a routing engine and get back a polyline and just plot that.

This logic seems more suitable for my solution, I already have the list points that I need to draw the route between them. can you point where is the API or how to build it.

There is a whole bunch of backend services mentioned here - https://wiki.openstreetmap.org/wiki/Routing/online_routers
and some offline ones here - https://wiki.openstreetmap.org/wiki/Routing/offline_routers

I haven't tried any of them so don't know how easy or hard any of the APIs are.
The openrouteservice one looks fairly comprehensive. https://openrouteservice.org/dev/#/api-docs