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 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:
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 | image::https://developer.tomtom.com/assets/downloads/tomtom-sdks/android/maps/vr/tt_restriction_hazmat_1_explosive_US.png[,48] image::https://developer.tomtom.com/assets/downloads/tomtom-sdks/android/maps/vr/tt_restriction_hazmat_2_flammablegas_US.png |
You can find those categories defined here HazmatClass
.
Next steps
Since you have learned how to work with vehicle restrictions, here are recommendations for next steps: