define(['leaflet'], function(L) {
// base config
var attribOSM = '© OpenStreetMap contributors',
attribCarto = '© CartoDB',
TileLayer = L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
attribution: 'Imagery ' + attribCarto + ' — Map data ' + attribOSM,
subdomains: 'abcd',
maxZoom: 19
}),
scale = L.control.scale({
imperial: false
});
return function(id, bounds) {
var map = L.map(id, {
layers: [TileLayer]
})
if (bounds) {
map.fitBounds(L.latLngBounds(bounds));
} else {
map.fitWorld().zoomIn();
}
map.attributionControl.setPrefix(false);
scale.addTo(map);
return map;
};
});