blob: 647ef313cb3cb3a4fa84fa556e7d3823a660e96d (
plain)
- define(['leaflet'], function(L) {
- // base config
- var attribOSM = '© <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors';
- var attribCarto = '© <a href="https://cartodb.com/attributions">CARTO</a>';
- var licenseODbL ='under the <a href="https://opendatacommons.org/licenses/odbl/1.0/">ODbL 1.0</a> license';
- var TileLayer = L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
- attribution: 'Imagery ' + attribCarto + ' — Map data ' + attribOSM + ' ' + licenseODbL,
- 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;
- };
- });
|