Leaflet



Leaflet is a widely used open source JavaScript library used to build web mapping applications. It helps us to quickly publish maps like this:

Here is a code excerpt showing key commands, like centering the map on a particular location, loading a tile layer, and adding a visual marker:

var map = L.map('map').setView([47.55662, 8.90370], 16);

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
	attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
...
L.marker([47.55662, 8.90370], {icon: greenIcon}).bindPopup("Hello, world.").addTo(map);

Visit leafletjs.com for details and examples. There is a tutorial in German here.


• Recommended by: