aboutsummaryrefslogtreecommitdiff
path: root/src/js/app/mapfactory.js
blob: f54060d412e831f9e113aafa9c0d1551c455448e (plain)
  1. define(['leaflet'], function(L) {
  2. // base config
  3. var attribOSM = '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  4. attribCarto = '&copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
  5. TileLayer = L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
  6. attribution: 'Imagery ' + attribCarto + ' &mdash; Map data ' + attribOSM,
  7. subdomains: 'abcd',
  8. maxZoom: 19
  9. }),
  10. scale = L.control.scale({
  11. imperial: false
  12. });
  13. return function(id, bounds) {
  14. var map = L.map(id, {
  15. layers: [TileLayer]
  16. })
  17. if (bounds) {
  18. map.fitBounds(L.latLngBounds(bounds));
  19. } else {
  20. map.fitWorld().zoomIn();
  21. }
  22. map.attributionControl.setPrefix(false);
  23. scale.addTo(map);
  24. return map;
  25. };
  26. });