Hi there
On many roads in OSM, no explicit speed limit is given. This may be due to that the information is still not mapped or due to that there is no explicit speed limit signed.
In any case, when no explicit `maxspeed` tag is available, and it looks like over 80% of all roads don't have it tagged, the router must assume reasonable defaults.
This is why maybe you are interested in a library I have been developing over the last month:
https://github.com/westnordost/osm-legal-default-speedsCheck out the demo, too:
https://westnordost.github.io/osm-legal-default-speedsGiven a set of tags and a country code, it will return the `maxspeed` tags that apply for this road, if the road type can be determined by the given tags exactly or fuzzily. It is based on the data meticulously collected in
https://wiki.openstreetmap.org/wiki/Default_speed_limits , i.e. sourced from actual legislation texts.
In particular, it also outputs the maxspeeds for other vehicle types, such as buses, so this may be even more valuable to you.
The library is written in Kotlin, so you should be able to use it out of the box (as Kotlin runs on the JVM). The library is however not published on maven central yet because I first want to wait for some feedback (on the interface etc.)
Additionally, as the above library needs to know in which country any one road is located: In case you have no mechanism yet to determine in which country any given road is located and fast, I can recommend to you this library I wrote in Java. I use it also for StreetComplete:
https://github.com/westnordost/countryboundariesCheers
Tobias