Vehicle restrictions

VERSION 0.71.1

Vehicle restrictions define which vehicles are allowed to use specific roads. Traditionally, they’ve been used to control access for trucks, delivery vans, and scooters. In recent years, climate and pollution regulations have introduced additional rules, such as those targeting electric vehicles (EVs) and high-emission vehicles. The Map Display SDK allows you to apply these restrictions to a vehicle defined by the user.

The Vehicle restrictions API is available through the TomTomMap object. To enable vehicle restrictions in your app, load the pre-defined StyleContainer.restrictionsStyle.

map.styleContainer = .restrictionsStyle

Next, define the vehicle by importing:

import TomTomSDKCommon

This provides access to the Vehicle protocol:

1let dimensions = try? VehicleDimensions(
2 weight: Measurement.tt.kilograms(8000),
3 axleWeight: Measurement.tt.kilograms(4000),
4 length: Measurement.tt.millimeters(8340),
5 width: Measurement.tt.millimeters(4650),
6 height: Measurement.tt.millimeters(3445),
7 numberOfAxles: 3
8)
9let vehicle = Truck(
10 maxSpeed: Measurement.tt.kilometersPerHour(120),
11 isCommercial: false,
12 combustionEngine: nil,
13 electricEngine: nil,
14 dimensions: dimensions,
15 hazmatClasses: [.intlExplosive, .intlGeneral, .unClass2Gas, .unClass1Explosive, .unClass6Toxic],
16 adrTunnelRestrictionCode: .b,
17 modelID: VehicleModelID("Fancy Truck")
18)

To show vehicle restrictions, it is important to ensure that the restrictions style is fully applied to the map. Since setting the style container is an asynchronous operation, you must retrieve the prepared map asynchronously before attempting to show vehicle restrictions.

1mapView.getMapAsync { map in
2 do {
3 try map.showVehicleRestrictions(vehicle: vehicle)
4 } catch {
5 print("Failed to show vehicle restrictions: \(error)")
6 }
7}

Vehicle Restrictions

To hide restrictions:

try? map.hideVehicleRestrictions()

To apply changes after updating vehicle restriction parameters:

try? map.updateVehicle(vehicle)

Low-emission zone


Low-Emission Zone

A low-emission zone is enabled by default using the pre-defined StyleContainer.restrictionsStyle.

Supported vehicle restriction types

Europe, CanadaNorway, Iceland, SwedenUS

No access


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Height limit


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Width limit


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Length limit


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Weight limit


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Axle weight limit


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Hazardous Materials


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

Goods Harmful To Water


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

does not occur

Explosive Materials


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

does not occur

ADR (B, C, D, E)


Supported Vehicle Restriction Types


Supported Vehicle Restriction Types

does not occur

UN Dangerous Goods Class

Explosives, Gases, Flammable Liquids, Flammable Solids, Oxidizing And Organix Substance, Toxic And Infectious Substance, Radioactive Material, Corrosives, Miscellaneous Dangerous Goods


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class


UN Dangerous Goods Class

Next steps

Since you have learned how to work with vehicle restrictions, here are recommendations for next steps: