Skip to main content

Traffic Layer

Contents

The L.ALKMaps.Layer.Traffic layer is used to display live or historical traffic data on the map. Traffic is color coded to indicate the severity of the traffic on a particular road. Green means light or no traffic, yellow represents medium traffic, and red indicates the heaviest traffic.

The available options for this layer are explained in the table below.

Parameter Type/Values Description
region String Data region for the traffic data. Default: NA
histDay String The histDay parameter is set to a string containing name of the day of the week. Valid values are:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Default: null
histTimeBin String The histTimeBin parameter is set to an integer representing a 15 minute block of time during the day. There are a 96 total 15 minute time bins for the day beginning with midnight as 0. Valid values are integers from 0 to 95. Some common time bin values are:
0 - 12am
32 - 8am
48 - 12pm
68 - 5pm
Default: null
histTimeZone String The histTimeZone parameter is the offset from UTC for the time zone. If omitted, UTC is assumed. The colon between the hours and minutes is required. See ISO 8601 for more details. Some common time zone offsets are:
-04:00 - Eastern Daylight Time
-07:00 - Pacific Daylight Time
-08:00 - Pacific Standard Time
Default: null
opacity number The opacity of the layer. Default: 0.5

Historical Traffic

To pull historical traffic data for a specific day and time, you’ll need to set the appropriate parameters (histDay, histTimeBin, and histTimeZone) on the layer.

To display the historical traffic data for a Tuesday at 7pm EDT, you would use the following code.

Regions

The traffic layer will default to the North America(“NA”). You can change this by specifying the region property of the parameters object.

Last updated November 23, 2021.
Contents