How the speed is calculated during routing


Could someone please help me understand how GraphHopper calculates speed during routing?
Some osm ids have max-speed tag and some have not. How and where GraphHopper uses max-speed (if in tag) and how calculates the max-speed if not in tag? After getting the max-speed, does it only use free-speed as max-speed*0.9 or do further calculations? For example: in fastestWeighting, what is the maxspeed and how was it determined for each road?

Is there any difference in urban/non-urban link speed? How it determines if a road is urban/rural and how the speed differs?

What is the purpose & difference of maxSpeedCalculator and CarAverageSpeedParser? And could you please direct me to the classes that determines maxspeed /freespeed?


Just realized version 7 (Oct,23) is kinda different from version 7(downloaded in March,23) I have been using. I am using that for a research project and thus updating to the newest may not possible.

In the October update Graphhopper is using to assign speed for links with unknown speed tag. I cannot find that in the version I am using (March,23). However, is still there with ‘defaultSpeedMap’. If road speeds are already assigned, what is the purpose of this ‘defaultSpeedMap’?