Vehicle Restrictions

VERSION {version}
PUBLIC PREVIEW

Vehicle Restriction is common feature used by trucks, delivery vans, and scooter drivers. Climate/pollution regulations are also introducing more rules for cars, for example electric vehicles (EVs) and rules for high emission cars.

The Map Display SDK provides the ability to apply those restrictions to a car defined by the user.

The Vehicle Restrictions API is available under the TomTomMap object. To enable vehicle restrictions in your app, first the load 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 = 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)

Finally, 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))

Vehicle Restrictions