Create a new ALK Maps Traffic overlay. You can display the current real-time traffic or show historical speeds based on day-of-week or time-of-day. It has to be Spherical Mercator projection, single tile and not base layer. In order to overlay traffic layer properly, the base layer has to use the same projection.
Examples
The code below creates a simple real-time traffice layer.
var alktraffic = new ALKMaps.Layer.Traffic("ALK LiveTraffic™", {}, {
minScale: 500000,
displayInLayerSwitcher: true //,
//sphericalMercator: true,
//singleTile:true
});
The code below creates a traffice layer from historical data.
var alktraffic = new ALKMaps.Layer.Traffic("ALK LiveTraffic™", {
histDay: "Friday",
histTimeBin: "32", // 8:00 AM
histTimeZone: "-04:00"
}, {
minScale: 500000,
displayInLayerSwitcher: true //,
//sphericalMercator: true,
//singleTile:true,
//attrUseHyperlink: false
});
Parameters
name | {String} A name for the layer |
params | {Object} An object with key/value pairs representing the parameters for the layer. |
- histDay - {String} Day of the week for historical traffic data, in English, spelled out. Case doesnt matter, but it cant be abbreviated. So “Monday”, “friday” are okay. If this or histTimeBin are blank you will get real-time traffic.
- histTimeBin - {integer} Time “bin” for the historical traffic data. Each “bin” is a 15 minute increment, starting at midnight as bin 0. That means there are 96 bins in total (0-95). 12:00am = 0, 12:15am = 1 ... 8:00am = 32 ... 5:00pm = 68 ... 11:45pm = 95... etc. If this or histDay are blank you will get real-time traffic.
- histTimeZone - {String} Time zone offset, see ISO 8601 for more details. The colon between hr and min is required. Example: “-04:00”
options | {Object} Hashtable of extra options to tag onto the layer. These options include all properties from the Grid parent class. |