aboutsummaryrefslogtreecommitdiff
path: root/src/js/app/places.js
blob: 370bc95d1a37e229a1701ee9db2b9acc75bd959a (plain)
  1. define([
  2.     'leaflet',
  3. 'leaflet.markercluster'
  4. ], function(L) {
  5. // GeoJSON feature grouping
  6. function returnMarker(feature, latlng) {
  7. var marker = new L.marker(latlng);
  8. // bindTooltip was introduced in LeafletJS 1.0.
  9. try {
  10. marker.bindTooltip(
  11. feature.properties.name,
  12. {permanent: true });
  13. } catch (e) {
  14. if (console) {
  15. console.warn('tooltip skipped (using an old Leaflet?)');
  16. }
  17. };
  18. return marker;
  19. };
  20. var place = L.geoJson([], {
  21. pointToLayer: returnMarker
  22. });
  23. return function(data) {
  24. place.addData(data);
  25. return L.markerClusterGroup().addLayer(place);
  26. };
  27. });