Vehicle restrictions
Vehicle restrictions are used commonly for trucks, delivery vans, and scooter drivers. Climate and 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 allows you to apply these restrictions based on a user-defined vehicle profile.
The Vehicle Restrictions API is available through the TomTomMap
object. To enable vehicle restrictions in your app, load the predefined StandardStyles.VEHICLE_RESTRICTIONS
.
1tomTomMap.loadStyle(2 StandardStyles.VEHICLE_RESTRICTIONS,3 onStyleLoadedCallback,4)
The next step is to define your vehicle. This can be done using the Vehicle
model.
1val truck =2 Vehicle.Truck(3 dimensions =4 VehicleDimensions(5 weight = Weight.kilograms(6420),6 axleWeight = Weight.kilograms(2200),7 length = Distance.centimeters(805),8 width = Distance.centimeters(260),9 height = Distance.centimeters(330),10 ),11 // You can define characteristics of your vehicle's load like Hazmat and ADR12 hazmatClasses =13 setOf(14 HazmatClass.IntlExplosive,15 HazmatClass.UnClass1Explosive,16 HazmatClass.UnClass2Gas,17 HazmatClass.UnClass3FlammableLiquid,18 ),19 adrTunnelRestrictionCode = AdrTunnelRestrictionCode.B,20 )
To show restrictions:
tomTomMap.showVehicleRestrictions(truck)

To hide restrictions:
tomTomMap.hideVehicleRestrictions()
To apply changes after updating the vehicle
parameters:
1val newDimension = VehicleDimensions(2 weight = Weight.kilograms(8000),3 axleWeight = Weight.kilograms(2200),4 length = Distance.centimeters(805),5 width = Distance.centimeters(260),6 height = Distance.centimeters(330),7)8tomTomMap.updateVehicle(9 Vehicle.Truck(10 dimensions = newDimension,11 hazmatClasses =12 setOf(13 HazmatClass.IntlExplosive,14 HazmatClass.UnClass1Explosive,15 HazmatClass.UnClass2Gas,16 HazmatClass.UnClass3FlammableLiquid,17 ),18 adrTunnelRestrictionCode = AdrTunnelRestrictionCode.B,19 ),20)
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 predefined 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: HazmatClass
.
Next steps
Since you have learned how to work with vehicle restrictions, here are some recommended next steps: