LegalDefaultSpeeds

class LegalDefaultSpeeds(roadTypesByName: Map<String, RoadTypeFilter>, speedLimitsByCountryCode: Map<String, List<RoadType>>)

Class with which to look up the default speed limits per country as specified in the given data (usually default_speed_limits.json)

Constructors

Link copied to clipboard
constructor(roadTypesByName: Map<String, RoadTypeFilter>, speedLimitsByCountryCode: Map<String, List<RoadType>>)

Types

Link copied to clipboard
data class Result(val roadTypeName: String?, val tags: Map<String, String>, val certitude: Certitude)

The result of looking for the speed limits via getSpeedLimits. It includes the road type name, the maxspeed tags that road type is assumed to have implicitly and a Certitude.

Functions

Link copied to clipboard
fun getSpeedLimits(countryCode: String, tags: Map<String, String>, relationsTags: List<Map<String, String>> = emptyList(), replacerFn: (name: String, evaluate: () -> Boolean) -> Boolean = { _, ev -> ev() }): LegalDefaultSpeeds.Result?

Given a country/subdivision and a set of tags on the road (segment), will return a set of additional maxspeed tags the road can be assumed to have based on other properties of the road or (optionally) of which relations it is a member of. Returns null if nothing was found.

Link copied to clipboard

Returns whether the given tag key is relevant for getting the speed limits. This can be used to reduce the tags set on roads to only the relevant ones, which makes the queries faster and makes it easier to cache it.