Layers

Layers provide an simpler means for overlaying data onto the map in a format that is viewable to the user. The ALK Maps plugin for Leaflet uses these layers to integrate the data returned from our services with Leaflet's existing source code in way that allows the developer to seemlessly incorporate ALK Maps into any Leaflet script.

Layers can be added to the map in two different ways. One way is by adding your layer(s) on map initialization. First define the layers you plan on adding, and then pass them as an array (unless it is a single layer) in the layers parameter when defining your map.

//L.ALKMaps.setApiKey("YourAPIKey");
var baseLayer = L.ALKMaps.Layer.baseMap({region: "NA", dataset: "Current", style: "default"});
var routingLayer = L.ALKMaps.Layer.routing({});
var map = L.map('map', {
    layers: [baseLayer, routingLayer],
    center: [51.505, -0.09],
    zoom: 3
});
                

The second method only permits you to add a single layer at a time, but can be done at any point in the code. Simply use the addLayer function of the L.Map class to add a layer, and the removeLayer function to remove a layer from the map.

//L.ALKMaps.setApiKey("YourAPIKey");
var map = L.map('map', {
    center: [51.505, -0.09],
    zoom: 3
});

var baseLayer = L.ALKMaps.Layer.baseMap({region: "NA", dataset: "Current", style: "default"});
map.addLayer(baseLayer);
                

BaseMap Layer

The L.ALKMaps.Layer.BaseMap layer provides the ALK Maps tiles used to display the map. For a more detailed explanation on the BaseMap layer please visit the BaseMap Layer Page.

Routing Layer

The L.ALKMaps.Layer.Routing layer has the ability to display multiple routes on the map in addition to retrieving various reports for each of those routes. For a more detailed explanation on the Routing layer please visit the Routing Layer Page.

Traffic Layer

The L.ALKMaps.Layer.Traffic layer has the ability to display live or historic traffic data on the map. For a more detailed explanation on the Traffic layer please visit the Traffic Layer Page.

WeatherRadar Layer

The L.ALKMaps.Layer.WeatherRadar layer has the ability to overlay live weather radar or satellite weather imagery on your map. For a more detailed explanation on the WeatherRadar layer please visit the WeatherRadar Layer Page.

WeatherAlerts Layer

The L.ALKMaps.Layer.WeatherAlerts layer can be used to display weather alerts data provided by the National Weather Service. For a more detailed explanation on the WeatherAlerts layer please visit the WeatherAlerts Layer Page.