L.ALKMaps.Layer.Traffic layer is used to display live or historic 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.
|Data region for the traffic data. Default: |
|The histDay parameter is set to a string containing name of the day of the week. Valid values are:|
|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
|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:|
|The opacity of the layer. Default: |
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.
The traffic layer will default to the North America(“NA”). You can change this by specifying the
region property of the parameters object.