aboutsummaryrefslogtreecommitdiff
path: root/src/js/app/mapfactory.js
blob: 8d8bb0e230103fc6ad656e2d3414dcd9d7a044be (plain)
  1. define(['leaflet'], function(L) {
  2. // base config
  3. var attribOSM = '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  4. OSMLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  5. attribution: attribOSM
  6. }),
  7. scale = L.control.scale({
  8. imperial: false
  9. });
  10. return function(id, bounds) {
  11. var map = L.map(id, {
  12. layers: [OSMLayer]
  13. })
  14. if (bounds) {
  15. map.fitBounds(L.latLngBounds(bounds));
  16. } else {
  17. map.fitWorld().zoomIn();
  18. }
  19. map.attributionControl.setPrefix(false);
  20. scale.addTo(map);
  21. return map;
  22. };
  23. });