What is Leaflet?

Leaflet is an open-source JavaScript library for building interactive maps.

Key Concepts

- It's designed to be map provider-agnostic.

// basic fullscreen map of the world
const map = Leaflet.map('map').fitWorld();

// add a tile layer
Leaflet.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
  attribution: '...',
  maxZoom: 18,
  tileSize: 512,
  zoomOffset: -1
}).addTo(map);

- Provides an API for initializing maps, managing state, etc.

- Simple, event-driven API is similar to DOM

(Also, Mapbox)

Live Coding Exercise!

Build a simple radio.garden clone.

Made with Slides.com