Leaflet control with order functionality
This plugin for leaflet provide support for order overlay layers in leaflet maps, for clone this code:
$ clone https://github.com/elesdoar/leaflet-control-orderlayers.git
var map = L.map('map');
var b1 = L.tileLayer('http://a.tiles.mapbox.com/v3/elesdoar.map-key/{z}/{x}/{y}.png', {
attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
maxZoom: 20
}).addTo(map);
var b2 = L.tileLayer('http://a.tiles.mapbox.com/v3/elesdoar.map-key/{z}/{x}/{y}.png', {
attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',
maxZoom: 20
});
var baseLayers = {
'Streets': b1,
'Night': b2
};
var hillshade = L.tileLayer.wms("http://129.206.228.72/cached/hillshade", {
layers: 'europe_wms:hs_srtm_europa',
format: 'image/png',
opacity: 0.45,
transparent: true,
attribution: 'Hillshade layer by GIScience http://www.osm-wms.de',
crs: L.CRS.EPSG900913
}).addTo(map);
var fire = L.tileLayer('http://openfiremap.org/hytiles/{z}/{x}/{y}.png', {
attribution: '© OpenFireMap contributors - © OpenStreetMap contributors',
continuousWorld: true
}).addTo(map);
var overlayLayers = {
'Hillshade': hillshade,
'OpenFireMap': fire
};
var controls = L.control.orderlayers(
baseLayers, overlayLayers,
{
collapsed: false,
title: 'Order Layers'
}
);
controls.addTo(map);
map.setView([4.649, -74.086], 11);
In 2013, Michael Salgado (@elesdoar).
MIT Licence