Want to Map the road, which will navigate according to shortest distance not time

Hi Mappers !
Greetings from Nepal.

We have used Open source routing machine as a navigation in our app. But navigation is showing the longer route than shorter one.

The reason is Longer route moves through trunk road and shorter one is from Primary road because trunk road have max. speed.

But moving through trunk road have :slightly_smiling_face:
Distance : 11.4km
Time : 9 min

If travelled from Primary road:
Distance : 7.8km and time is 8 min

I want to make routing from primary road, because if travel from shortest route will decrease the cost for travel.

Can anyone help on this issue.

For reference image has been uploaded:

Which routing profile are you using? Default car.lua or a custom one?

Looking through car.lua you can see in line 20 that it sets weight_name = routability for “routing based on duration, but weighted for preferring certain roads”. You could try changing it to weight_name = distance and see what happens?

Also, this map lets you see where maxspeed is in the OSM data. Looking at the map I can see that maxspeed is missing from some of the ring road between Kalanki and Koteshwor. Also, in the areas it has been mapped, it has only been mapped for one direction.

When no max speed is set, routing profiles have to make assumptions about the speed you can drive. Looking through car.lua it defines a speed for trunk of 85 km/h and a default maxspeed for trunk of 110 km/h. This obviously doesn’t make sense for Kathmandu ring road.

Maybe this is why it is preferring the trunk over the primary?

So if I were you I would try

  • in OSM, add the maxspeed tag everywhere it is missing
  • make a modified version of car.lua and change the weight_name
  • change the default values to some more sensible ones
2 Likes

Looking at OpenStreetMap and OpenStreetMap - the routing engine expects that trunk route will be faster.

Can you survey missing data and add it to OSM? Some useful road properties are missing.

Many cities nowadays prefer that car traffic goes not through the city but instead uses the ring roads around it so in that sense the current behavior might be “wanted”.

I also think that it could well be reality, the trunk route has likely a higher speed and less/no traffic lights.

The time numbers of routers also have a pretty limited accuracy, maxspeed is typically used but traffic lights, crossings etc. not.

It would be interesting to do an actual test, have two cars start at the same time but use the different routes. But also this is likely very time-of-day dependent.

Using the shortest, fastest or safest route should be an option of the routing engine, not the data.

Brouter can do that, others as well?

https://brouter.de/brouter-web/#map=12/47.5981/12.1916/osm-mapnik-german_style&profile=shortest