Search for content

Truck Restrictions

Truck restrictions symbolize either complete driving restrictions for trucks or they indicate a driving permit under restricted conditions depending on physical characteristics such as weight, length or height. Some truck restrictions are time-dependent, while others apply permanently. 

API endpoint

You need the following API endpoint to request truck restrictions:

https://api.myptv.com/maps/overlays/v1/vector-tiles/

Request

For a single tile showing Paris, France specify the map tile path with zoomLevel, x and y as shown below.

You can test this by entering the URL into your web browser. Be sure to replace YOUR_API_KEY with your actual API key.

https://api.myptv.com/maps/overlays/v1/vector-tiles/11/1037/704?layers=truckRestrictions&apiKey=YOUR_API_KEY

Get your free API Access Key

Response

The call result is a single map tile in MapBox Vector Tiles format.

Data content

 

Tile content

The requested vector tile contains data which is listed in this table. The individual columns are explained below.

List of tile content
Name of contentType
geometrySRID 3857 
restriction_typeinteger
time_dependentboolean
closure_directioninteger
restriction_type_descriptiontext
structured_descriptionsjson format
iso_country_codechar
display_categoryinteger
heightinteger
weightinteger
widthinteger
lengthinteger
axle_loadinteger
number_of_axlesinteger
kingpin_rear_axle_lengthinteger
hazardous_material_typeinteger

Restriction types

The following table shows the different restriction types and their meaning, as well as an example description. Note that the data values are provided in units of cm and kg, but the description texts use m and t. These units were chosen on purpose to avoid floating point inconsistencies in calculations.

List of icon Truck Restrictions and what they symbolize.
IconMeaningUnitRestriction type Restriction type descriptionExample description available in structured_descriptions[i].description

Multiple restrictions on the same road segment.

 -1Combined restrictions 

The maximum vehicle height allowed.

cm1Height restrictionMaximum vehicle height: 3,5 m
The maximum vehicle weight allowed.kg2Weight restrictionMaximum vehicle weight: 1 t

The maximum vehicle width allowed.

cm3Width restrictionMaximum vehicle width: 3 m
The maximum vehicle length allowed.cm4Length restrictionMaximum vehicle length: 4 m
The maximum axle load allowed.kg5Axle load restrictionMaximum vehicle axle load: 1 t

Restricted number of axles.

 6Restricted number of axlesMaximum number of axles: 4
The tunnel restriction code B. 8Tunnel restriction: Code BTunnel restriction: Code B
The tunnel restriction code C. 9Tunnel restriction: Code CTunnel restriction: Code C
The tunnel restriction code D. 10Tunnel restriction: Code DTunnel restriction: Code D
The tunnel restriction code E. 11Tunnel restriction: Code ETunnel restriction: Code E
Not allowed for vehicles carrying hazardous goods. 12Hazardous goods not allowedBlocked for transports with hazardous goods
Not allowed for vehicles carrying goods hazardous to water. 13Goods hazardous to water not allowedBlocked for transports with goods hazardous to water.
Not allowed for vehicles carrying combustibles. 14Combustibles not allowedBlocked for transports with explosive substances.
General truck restriction, independent if a truck has a trailer or not. 15General access restrictionBlocked for trucks
Trucks with trailer restriction. 16Trucks with trailer restrictionBlocked for vehicles with trailer
Length restriction for trucks with trailers.cm17Length restriction for trucks with trailersMaximum vehicle length (including trailer): 5 m
Width restriction for trucks with trailers.cm18Width restriction for trucks with trailersMaximum vehicle width (including trailer): 3 m
General truck restriction except for delivery vehicles. 19General access restriction except for deliveriesBlocked for trucks - free for deliveries
The maximum vehicle weight allowed with an exception for delivery vehicles.kg20Free for deliveriesMaximum vehicle weight: 1 t - free for deliveries 

 

Tunnel restrictions

Defines the main tunnel restriction codes according to ADR ("European Agreement Concerning the International Carriage of Dangerous Goods by Road"). There are some more restriction codes that are a combination of the main codes where the actual restriction code depends on other parameters of the vehicle and its load. For example, the restriction code B/D is B for tank carriage and D for other carriage.

 

Tunnel enumeration valueMeaning
BPassage forbidden through tunnels of category B, C, D and E.
CPassage forbidden through tunnels of category C, D and E.
DPassage forbidden through tunnels of category D and E.
EPassage forbidden through tunnels of category E.

Hazardous goods, hazardous to waters and combustibles

Truck restrictions for specific hazardous materials like hazardous to waters or combustibles are subsets of hazardous goods. That means if a road segment is restricted for hazardous goods, the segment is also restricted for transports carrying goods hazardous to waters or combustibles.

Closure direction 

Closure direction is an attribute that defines the direction of the link or lane closed for vehicles with specific restrictions. The direction is symbolized with an arrow pattern in our PTV style if the closure is only valid for one direction. 

Closure directionMeaning
0Not set in the data
-1Only valid for restriction_type = -1: The single restrictions have different directions
1Closed in both directions
2Closed in positive direction, meaning the restriction is valid in the direction in which the coordinates of the geometry are stored.
3Closed in negative direction, meaning the restriction is valid in the opposite direction in which the coordinates of the geometry are stored.

 

Display category

Defines the importance of a road segment on which a restriction is located. Restricted road segments with a high priority are displayed earlier than restricted road segments with a lower priority.

Display categoryMeaning
1The most important road segments like motorways and two-lane federal highways.
2Road segments of medium importance like single-lane federal highways or land roads.
3All other road segments.

Time dependency

Some truck restrictions are time-dependent. That means they are only valid for a special time span. 

The structured_descriptions parameter is an array of JSON objects where each object has the following structure:

// typed explanation of a structured_descriptions object 
{
	description: string;
	time_domain_descriptions: string[];
}

The description part contains a formatted text that expresses the type and value of the restriction. The time_domain_descriptions are only available for time-dependent restrictions and contain a list of formatted texts that describe the times or time spans when this restriction is valid. 

For example:

{
	description: "Maximum vehicle weight: 7.5 t",
	time_domain_descriptions: [
		"Valid on Sat every week from 07:00 to 20:00",
		"Valid from January to June from 07:00 to 20:00",
		"Valid from September to December from 07:00 to 20:00"
	]
}

You can, for example, use these descriptions to show a popup in your UI when the user clicks on a truck restriction icon. 

Country code

ISO country code contains a three-character country code. Examples are DEU for Germany or FRA for France. You can find more information about this code here: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes 

The PTV style contains special country-dependent icons for Canada, USA and Mexico. 

 

List of country dependent icons.
Icon DefaultCanadaUSAMexicoMeaning
Multiple restrictions on the same road segment.
The maximum vehicle height allowed.
The maximum vehicle weight allowed.
The maximum vehicle width allowed.
   The maximum vehicle length allowed.
 The maximum axle load allowed.
   

Restricted number of axles.

 The tunnel restriction code B.
 The tunnel restriction code C.
 The tunnel restriction code D.
 The tunnel restriction code E.
 Not allowed for vehicles carrying hazardous goods.
   Not allowed for vehicles carrying goods hazardous to water.
Not allowed for vehicles carrying combustibles.
General truck restriction, also valid for trucks with trailers.
   General truck restriction valid for trucks with trailers.
   Length restriction for trucks with trailers.
   Width restriction for trucks with trailers.
  General truck restriction except for delivery vehicles.
  Weight restriction except for delivery vehicles.

 

 

Styling

Truck restrictions are symbolized through lines and icons. If there is more than one restriction on a road segment, this is symbolized by a group icon. Lines generally define restrictions on this road segment. The icons indicate which type of restriction is valid on the road segment.

 

 

Layer names

Our predefined layer styles have a recurring naming scheme. All layers start with TSP_TruckRestrictions_HERE or TSP_TruckRestrictions_Shield_HERE

Layer NameDescription
TSP_TruckRestrictions_HERE_Major_OuterDefines the outline style for restrictions on road segments with higher priority.
TSP_TruckRestrictions_HERE_Major_InnerDefines the line style for restrictions on road segments with higher priority.
TSP_TruckRestrictions_HERE_Minor_OuterDefines the outline style for restrictions on road segments with minor priority.
TSP_TruckRestrictions_HERE_Minor_InnerDefines the line style for restrictions on road segments with minor priority.
TSP_TruckRestrictions_HERE_OnewayDefines the line style for uni-directional restrictions with arrowed lines.
TSP_TruckRestrictions_Shield_HEREDefines the style for restriction icons (Europe).
TSP_TruckRestrictions_Shield_HERE_USADefines the style for restriction icons (USA).
TSP_TruckRestrictions_Shield_HERE_MEXDefines the style for restriction icons (Canada).
TSP_TruckRestrictions_Shield_HERE_CANDefines the style for restriction icons (Mexico).

Each single layer definition carries information of how to render a restriction from a vector tile. The layers are rendered in the order as they are defined in your style.json

   {
     "id": "TSP_TruckRestrictions_HERE_Major_Outer",
     "type": "line",
     "source": "ptv-content",
     "source-layer": "HERE_TruckRestrictionLayer",
     "minzoom": 9,
     "filter": [
       "all",
       ["!=", "restriction_type", 0],
       ["in", "display_category", 1, 2]
     ],
     "layout": {
       "line-cap": "round",
       "line-join": "round",
       "visibility": "visible"
     },
     "paint": {
       "line-width": {"base": 5, "stops": [[12, 5], [15, 7], [18, 9]]},
       "line-color": "rgba(150, 10, 10, 1)",
       "line-opacity": 1
     }
   },
   {
     "id": "TSP_TruckRestrictions_HERE_Major_Inner",
     "type": "line",
     "source": "ptv-content",
     "source-layer": "HERE_TruckRestrictionLayer",
     "minzoom": 9,
     "filter": [
       "all",
       ["!=", "restriction_type", 0],
       ["in", "display_category", 1, 2]
     ],
     "layout": {
       "line-cap": "round",
       "line-join": "round",
       "visibility": "visible"
     },
     "paint": {
       "line-width": {"base": 2, "stops": [[12, 3], [15, 5], [18, 7]]},
       "line-color": "rgba(220,50, 80, 1)",
       "line-opacity": 1
     }
   },
   {
     "id": "TSP_TruckRestrictions_HERE_Minor_Outer",
     "type": "line",
     "source": "ptv-content",
     "source-layer": "HERE_TruckRestrictionLayer",
     "minzoom": 12,
     "filter": [
       "all",
       ["!=", "restriction_type", 0],
       ["in", "display_category", 3]
     ],
     "layout": {
       "line-cap": "round",
       "line-join": "round",
       "visibility": "visible"
     },
     "paint": {
       "line-width": {"base": 4, "stops": [[12, 5], [15, 7], [18, 9]]},
       "line-color": "rgba(150, 10, 10, 1)",
       "line-opacity": 1
     }
   },
   {
     "id": "TSP_TruckRestrictions_HERE_Minor_Inner",
     "type": "line",
     "source": "ptv-content",
     "source-layer": "HERE_TruckRestrictionLayer",
     "minzoom": 12,
     "filter": [
       "all",
       ["!=", "restriction_type", 0],
       ["in", "display_category", 3]
     ],
     "layout": {
       "line-cap": "round",
       "line-join": "round",
       "visibility": "visible"
     },
     "paint": {
       "line-width": {"base": 3, "stops": [[12, 3], [15, 5], [18, 7]]},
       "line-color": "rgba(220, 50, 80, 1)",
       "line-opacity": 1
     }
   },
   {
     "id": "TSP_TruckRestrictions_HERE_Oneway",
     "type": "symbol",
     "source": "ptv-content",
     "source-layer": "HERE_TruckRestrictionLayer",
     "minzoom": 16,
     "filter": [
       "all",
       ["!=", "restriction_type", 0],
       ["in", "closure_direction", 2, 3]
     ],
     "layout": {
       "symbol-placement": "line",
       "icon-rotate": [
         "case",
         ["==", ["get", "closure_direction"], 2],
         0,
         ["==", ["get", "closure_direction"], 3],
         180,
         0
       ],
       "icon-size": 0.5,
       "text-allow-overlap": true,
       "icon-allow-overlap": true,
       "icon-image": "restriction-arrow",
       "symbol-spacing": 1
     }
   },
   ...
   {
        "id": "TSP_TruckRestrictions_Shield_HERE",
        "type": "symbol",
        "source": "ptv-content",
        "source-layer": "HERE_TruckRestrictionLayer",
        "minzoom": 12,
        "filter": [
           "all",
           [ "!=", "restriction_type", 0 ],
           [ "!=", "iso_country_code", "USA" ],
           [ "!=", "iso_country_code", "MEX" ],
           [ "!=", "iso_country_code", "CAN" ],
           [ "in", "display_category", 1, 2, 3 ]
        ],
        "layout": {
            "icon-image": [
                "image",
                [
                    "concat",
                    "truckblock-",
                    [ "get", "restriction_type" ]
                ]
            ],
            "symbol-placement": "line",
            "symbol-spacing": 600,
            "icon-size": 1,
            "icon-rotation-alignment": "viewport",
            "visibility": "visible"
        },
        "paint": {
            "text-color": "rgba(0, 0, 0, 1)",
            "text-opacity": 1
        }
    },

 

A layer definition generally consists of many parameters. You can find here a more detailed description about the parameters and the spritesheets in the styling documentation.

How to implement

The tutorial on how to integrate overlays into a Vector Map also addresses truck restrictions.