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