Vehicle Restrictions
Vehicle restrictions are used commonly for trucks, delivery vans, and scooter drivers. Climate/pollution regulations are also introducing more rules for cars, such as electric vehicles (EVs) and cars that fail to meet various low-emission vehicle requirements.
The SDK provides the ability to apply those restrictions based on the user-defined vehicle profile.
The Vehicle Restrictions API is available under the TomTomMap
object. To enable vehicle restrictions in your app, load the pre-defined StandardStyles.VEHICLE_RESTRICTIONS
.
1tomTomMap.loadStyle(2 StandardStyles.VEHICLE_RESTRICTIONS,3 onStyleLoadedCallback4)
The next step is to define your vehicle. This can be done using the Vehicle
model
1val truck = Vehicle.Truck(2 dimensions = VehicleDimensions(3 weight = Weight.kilograms(6420),4 axleWeight = Weight.kilograms(2200),5 length = Distance.centimeters(805),6 width = Distance.centimeters(260),7 height = Distance.centimeters(330)8 ),9 // You can define load type of your vehicle like Hazmat and ADR10 loadType = setOf(11 VehicleLoadType.OtherHazmatExplosive,12 VehicleLoadType.UnHazmatClass1,13 VehicleLoadType.UnHazmatClass2,14 VehicleLoadType.UnHazmatClass3,15 ),16 adrTunnelRestrictionCode = AdrTunnelRestrictionCode.B17)
To show restrictions:
tomTomMap.showVehicleRestrictions(truck)

To hide restrictions:
tomTomMap.hideVehicleRestrictions()
To apply changes after updating the vehicle
parameters:
val newDimension = truck.dimensions?.copy(weight = Weight.kilograms(8000))tomTomMap.updateVehicle(truck.copy(dimensions = newDimension))
Low-emission zone

A low-emission zone is an area that restricts access to vehicles based on the level of pollutants they emit. By default, you can enable a low-emission zone using the pre-defined style StandardStyles.VEHICLE_RESTRICTIONS
.
Supported vehicle restriction types
The following table shows the supported vehicle restriction types:
Europe, Canada | Norway, Iceland, Sweden | US | |
No access | |||
Height limit | |||
Width limit | |||
Length limit | |||
Weight limit | |||
Axle weight limit | |||
Hazardous Materials | |||
Goods Harmful To Water | does not occur | ||
Explosive Materials | does not occur | ||
ADR (B, C, D, E) | does not occur |
UN dangerous goods class
The UN dangerous goods class describes the categories of dangerous cargo as follows:
Explosives, Gases, Flammable Liquids, Flammable Solids, Oxidizing And Organic Substance, Toxic And Infectious Substance, Radioactive Material, Corrosives, Miscellaneous Dangerous Goods |
You can find those categories defined here VehicleLoadType
.
Next steps
Since you have learned how to work with vehicle restrictions, here are recommendations for next steps: