ALKMaps.Layer.Traffic

Instances of ALKMaps.Layer.Traffic are used to display traffic maps.  This layer only supports Spherical Mercator with single tile.  It can’t be used as a base layer by default.

Inherits from

Summary
ALKMaps.Layer.TrafficInstances of ALKMaps.Layer.Traffic are used to display traffic maps.
Properties
reprojectDeprecated.
isBaseLayer{Boolean} Default is false for traffic layer.
singleTile{Boolean} Use single tile for Traffic image.
sphericalMercator{Boolean} Traffic layer only has Spherical Mercator map.
projection{String} Use Spherical Mercator for traffic.
regionData region.
Constructor
ALKMaps.Layer.TrafficCreate a new ALK Maps Traffic overlay.
Functions
setMap
destroyDestroy this layer
cloneCreate a clone of this layer
getURLReturn a query string for this layer
getXYZCalculates x, y and z for the given bounds.
getFullRequestStringCombine the layer’s url with its params and these newParams.

Properties

reproject

Deprecated.  {Boolean} Try to reproject this layer if its coordinate reference system is different than that of the base layer.  Default is false.  Set this in the layer options.  Should be set to false in most cases.

isBaseLayer

{Boolean} Default is false for traffic layer.

singleTile

{Boolean} Use single tile for Traffic image.  Default false.

sphericalMercator

{Boolean} Traffic layer only has Spherical Mercator map.

projection

{String} Use Spherical Mercator for traffic.  “EPSG:900913” only

region

Data region.

Constructor

ALKMaps.Layer.Traffic

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 doesn’t matter, but it can’t 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.

Functions

setMap

setMap: function (map)

Parameters

map{ALKMaps.Map} The map.

destroy

destroy: function()

Destroy this layer

clone

clone: function(obj)

Create a clone of this layer

Returns

{ALKMaps.Layer.BaseMap} An exact clone of this layer

getURL

getURL: function(bounds)

Return a query string for this layer

Parameters

bounds{ALKMaps.Bounds} A bounds representing the bbox for the request.

Returns

{String} A string with the layer’s url and parameters and also the passed-in bounds and appropriate tile size specified as parameters.

getXYZ

Calculates x, y and z for the given bounds.

Parameters

bounds{ALKMaps.Bounds}

Returns

{Object}an object with x, y and z properties.

getFullRequestString

getFullRequestString: function(newParams,
altUrl)

Combine the layer’s url with its params and these newParams.

Parameters

newParams{Object}
altUrl{String} Use this as the url instead of the layer’s url

Returns

{String} Layer url.

setMap: function (map)
destroy: function()
Destroy this layer
clone: function(obj)
Create a clone of this layer
getURL: function(bounds)
Return a query string for this layer
getFullRequestString: function(newParams,
altUrl)
Combine the layer’s url with its params and these newParams.
Base class for layers that use a lattice of tiles.
Instances of ALKMaps.Map are interactive maps embedded in a web page.
Instances of ALKMaps.Layer.BaseMap are used to display data from ALK Web Service Create a new ALK Map layer with the ALKMaps.Layer.BaseMap constructor.
Instances of this class represent bounding boxes.
Close