Skip to content

Plugin to show geotagged photos on a Leaflet map.

License

Notifications You must be signed in to change notification settings

kamoshi/leaflet-photo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet.Photo in TypeScript

Plugin to show geotagged photos on a Leaflet map.

Example usage

const template = `
  <div class="popup">
    <a href="{photo}">
      <img width="{width}" height="{height}" src="{photo}" />
      <div class="meta">
        <span class="date">{date}</span><span class="caption">{caption}</span>
      </div>
    </a>
  </div>
`;

const photoLayer = L.photo.cluster().on('click', function(evt) {
  evt.layer.bindPopup(L.Util.template(template, evt.layer.photo)).openPopup();
});

const data = [
  {
    photo: 'https://example.com/image.png',
    width: 1080,
    height: 960,
    date: '2023-01-01',
    caption: 'What a nice photo!',
  },
  {
    photo: 'https://example.com/image.png',
    width: 1080,
    height: 960,
    date: '2023-01-02',
    caption: 'What a nice photo!',
  }
];

photoLayer.add(data).addTo(map);

About

Plugin to show geotagged photos on a Leaflet map.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 79.3%
  • CSS 20.7%