Leaflet

A Modern, Lightweight Open-Source JavaScript Library for Interactive Maps by CloudMade



About the library

Leaflet is a modern, lightweight BSD-licensed JavaScript library for powering websites and web apps with tile-based interactive maps. It will form the core of CloudMade's next generation JavaScript API.

Leaflet is built from the ground up to work efficiently and smoothly on both desktop and mobile web browsers, utilizing cutting-edge technologies included in HTML5. It's main priorities are usability, performance, A-grade browser support, flexibility and easy to use API. The OOP-based code of the library is designed to be modular, extensible and very easy to understand.


Basic usage example

var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/YOUR-API-KEY/997/256/{z}/{x}/{y}.png',
	cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18});
	
var map = new L.Map('map');
map.setView(new L.LatLng(51.505, -0.09), 13).addLayer(cloudmade);

var marker = new L.Marker(new L.LatLng(51.5, -0.09));
map.addLayer(marker);

marker.bindPopup("A pretty CSS3 popup.<br />Easily customizable.").openPopup();

© 2011 CloudMade. Map data © 2011 OpenStreetMap contributors, CC-BY-SA.

Fork me on GitHub