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