NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


Our administrators install OSRM v5. I try build the shortest route. uri: /route/v1/driving/50.792940,61.659061;50.798636,61.665437;50.811901,61.669517;50.768080,61.730977 server return faster route (about 11,5 km) and i can`t find how build shortest route (aboute 10 km).

Can i do this by options in request string or need change config on server. Or it is not possible.

thank you in advancealt text

asked 26 Apr '17, 13:31

Alex%20taxi21's gravatar image

Alex taxi21
accept rate: 0%

edited 26 Apr '17, 15:02

escada's gravatar image


Thank you for your responses )

It is a pity that can not just ask the OSRM option in the query to build the shortest route (

(27 Apr '17, 14:18) Alex taxi21

Note: this is not from first hand experience.

OSRM always only has one profile per instance, at least when it is run in normal CH mode. And, as far as I know, the standard setup optimizes drive time, not distance. In other words you would have to set up an instance that uses the travelled distance as the metric (which I assume is possible, bat may be not easy).

permanent link

answered 26 Apr '17, 21:45

SimonPoole's gravatar image

SimonPoole ♦
accept rate: 18%

Can you tell more about travelled distance as the metric? I tried build alternative routes by options, but OSRM always build only that route for points like in picture

(27 Apr '17, 07:51) Alex taxi21

This works

but if i extend the route south a small amount the route takes the detour you have found. The obvious route your dotted one as a 60kph speed limit mapped the used alternative as no limit set. Maybe osrm calculates that as slower because of the 60kph

permanent link

answered 27 Apr '17, 08:26

andy%20mackey's gravatar image

andy mackey
accept rate: 4%

edited 27 Apr '17, 08:29

To get the shortest route, you will need to create a custom profile (a .lua file) where all roads are weighted at the same speed. The routing algorithm will then choose a 5-mile unclassified road (at 60mph) in preference to a 6-mile trunk road (at 60mph), whereas the standard car.lua will choose a 6-mile trunk road at 60mph in preference to a 5-mile unclassified road at 40mph.

You will need to specify the path to your profile in the command line when calling osrm-extract. I would recommend starting with car.lua and modifying it rather than creating a new profile from scratch.

As Andy has mentioned, I gave a brief overview of OSRM's profiles at .

permanent link

answered 27 Apr '17, 08:53

Richard's gravatar image

Richard ♦
accept rate: 18%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 26 Apr '17, 13:31

question was seen: 5,876 times

last updated: 27 Apr '17, 14:35

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum