aboutsummaryrefslogtreecommitdiff
path: root/src/js/app/places.js
blob: 99c158a104d74bbddc72e2e0293e561f887749ee (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.CircleMarker(latlng,{
  8. color: 'none',
  9. fillColor: 'rgba(110, 204, 57, 0.6)',
  10. fillOpacity: '1',
  11. });
  12. // bindTooltip was introduced in LeafletJS 1.0.
  13. try {
  14. marker.bindTooltip(
  15. feature.properties.name
  16. );
  17. } catch (e) {
  18. if (console) {
  19. console.warn('tooltip skipped (using an old Leaflet?)');
  20. }
  21. };
  22. return marker;
  23. };
  24. var place = L.geoJson([], {
  25. pointToLayer: returnMarker
  26. });
  27. return function(data) {
  28. place.addData(data);
  29. return L.markerClusterGroup().addLayer(place);
  30. };
  31. });