Leaflet quick start guide
[
Source: Leaflet tutorial
]
Setup
CSS
JS Leafleft library
JS script
var mymap = L.map('mapid').setView([51.505, -0.09], 13); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiamVzY2FjZW5hIiwiYSI6ImNpcnc0aGY0aDAwaG1ocW0xNzgwYWZrOXcifQ.dowcr7bOEgJfRtWF4GCU2Q', { attribution: 'Map data ©
OpenStreetMap
contributors,
CC-BY-SA
, Imagery ©
Mapbox
', maxZoom: 18, id: 'jescacena.14i0d24m', accessToken: 'pk.eyJ1IjoiamVzY2FjZW5hIiwiYSI6ImNpcnc0aGY0aDAwaG1ocW0xNzgwYWZrOXcifQ.dowcr7bOEgJfRtWF4GCU2Q' }).addTo(mymap);
Simple map
Markers, circles and polygons
Working with popups
Dealing with events
Click anywhere in the map