Leaflet (software)

Leaflet
Original authorVolodymyr Agafonkin
ReleaseMay 13, 2011 (2011-05-13)
Stable release
1.9.4Edit this on Wikidata / 18 May 2023; 3 years ago (18 May 2023)
Written inJavaScript
PlatformSee Browser support
TypeJavaScript library
LicenseBSD-2-Clause
Websiteleafletjs.com
Repository

Leaflet is a JavaScript library used to build web mapping applications. It allows developers to display tiled web maps hosted on a public server, with optional tiled overlays. It can load feature data from GeoJSON files, style it and create interactive layers, such as markers with popups when clicked.

First released in 2011, it supports most mobile and desktop platforms, supporting HTML5 and CSS3. Among its users are FourSquare, Pinterest, Flickr, and the USGS.

Leaflet is open source, and is developed by Ukrainian developer Volodymyr Agafonkin, who joined Mapbox in 2013. After the invasion of Ukraine by Russia in 2022, a version of logo was created to reflect the colours of Ukraine, which is used on a pop-up the first page of the website, promoting support for Ukraine.

Use

A basic demo using Leaflet.

A typical use of Leaflet involves binding a Leaflet "map" element to an HTML element such as a div. Layers and markers are then added to the map element.

Features

Leaflet supports Web Map Service (WMS) layers, GeoJSON layers, Vector layers and Tile layers natively. Many other types of layers are supported via plugins.

Like other web map libraries, the basic display model implemented by Leaflet is one basemap, plus zero or more translucent overlays, with zero or more vector objects displayed on top.

Elements

The major Leaflet object types are:

There is also a variety of utility classes such as interfaces for managing projections, transformations and interacting with the Document Object Model (DOM).

Support for GIS formats

Leaflet has core support for multiple geographic information system (GIS) standard formats, with others supported in plugins.

StandardSupport
GeoJSONGood, core support through the geoJson function
KML, CSV, WKT, TopoJSON, GPXSupported in Leaflet-Omnivore plugin
TMS Core support through TileLayer
WMSCore support through the TileLayer.WMS subtype
WFSNot supported, although third-party plugins exist.
GMLNot supported.

Browser support

Leaflet 1.9 supports Chrome, Firefox, Safari 5+, Opera 12+, IE 9–11 and Edge.

Leaflet 0.7 supported Chrome, Firefox, Safari 5+, Opera 12+ and IE 7–11.

Comparison with other libraries

Leaflet is directly comparable with OpenLayers, as both are open source, client-side only JavaScript libraries. The library as a whole is much smaller, around 7,000 lines of code compared to OpenLayers' 230,000 (as of 2015). It has a smaller code footprint than OpenLayers (around 123 KB vs 423 KB) due partly to its modular structure. The code base is newer, and takes advantage of recent features of JavaScript, plus HTML5 and CSS3. However, Leaflet lacks features OpenLayers supports, such as Web Feature Service (WFS) and native support for projections other than Google Web Mercator (EPSG 3857).

It is also comparable to the proprietary, closed source Google Maps API (debuting in 2005) and Bing Maps API, both of which incorporate a significant server-side component to provide services such as geocoding, routing, search and integration with features such as Google Earth.[citation needed] Google Maps API provides speed and simplicity, but is not flexible, and can only be used to access Google Maps services. The new DataLayer part of Google's API does allow external data sources to be displayed, however.

History

Leaflet began life in 2010 as "Web Maps API", a JavaScript library for the CloudMade mapping provider, where Agafonkin worked at the time. In May 2011, CloudMade announced the first release of Leaflet, built from scratch but using parts of the old API code.

In March 2022, the developer urged action on the Russian invasion of Ukraine on the Leaflet website.

References

  1. ↑ "v1.9.4 Latest". 18 May 2023. Retrieved 20 May 2023.
  2. ↑ "License - Leaflet". Leaflet. Retrieved 3 November 2018.
  3. ↑ Lovelace, Robin. "Testing web map APIs - Google vs OpenLayers vs Leaflet". Archived from the original on 3 November 2017. Retrieved 3 November 2018.
  4. ↑ MacWright, Tom (6 August 2014). "Leaflet Creator Vladimir Agafonkin Joins MapBox". Archived from the original on 12 September 2015. Retrieved 3 November 2018.
  5. ↑ "Making online interactive maps with Leaflet". The Digital Orientalist. 3 January 2019. Retrieved 20 March 2026.
  6. ↑ "Leaflet API reference". Retrieved 3 November 2018.
  7. ↑ "Using GeoJSON with Leaflet". Retrieved 3 November 2018.
  8. ↑ "leaflet-omnivore". 5 October 2021 – via GitHub.
  9. ↑ "TileLayer.WMS". Retrieved 3 November 2018.
  10. ↑ "TileLayer.WMS". Retrieved 3 November 2018.
  11. ↑ "Leaflet with WFS Example". 19 July 2019 – via GitHub.
  12. ↑ "Support for GML". GitHub. 23 June 2012. Retrieved 3 November 2018.
  13. ↑ "Leaflet - Features". leafletjs.com. Archived from the original on 18 July 2026. Retrieved 22 July 2026.
  14. ↑ "Features". leafletjs.com. Archived from the original on 18 January 2014. Retrieved 3 November 2018.
  15. ↑ "OpenHub.net comparison between OpenLayers and Leaflet". OpenHub.net. Archived from the original on 8 August 2014. Retrieved 3 November 2018.
  16. ↑ "Leaflet frontpage". Leaflet - An Open-Source JavaScript Library for Mobile-Friendly Interactive Maps. Retrieved 3 November 2018.
  17. ↑ "OpenLayers 3.4.0 compressed source code". OpenLayers.org. Archived from the original on 29 November 2016. Retrieved 3 November 2018.
  18. ↑ Various plugins providing WFS-support are listed on https://leafletjs.com/plugins.html
  19. ↑ "Projection". Retrieved 3 November 2018.
  20. ↑ "Data Layer". Google Maps Platform. Google Inc. Retrieved 3 November 2018.
  21. ↑ "Announcing Leaflet: a Modern Open Source JavaScript Library for Interactive Maps". CloudMade. 13 May 2011. Retrieved 3 November 2018.{{cite web}}: CS1 maint: deprecated archival service (link)
  22. ↑ Agafonkin, Vladimir (17 January 2013). "Leaflet 0.5 Released". Retrieved 3 November 2018.
  23. ↑ Agafonkin, Vladimir (26 June 2013). "Leaflet 0.6 Released, Code Sprint in DC with MapBox". Retrieved 3 November 2018.
  24. ↑ Agafonkin, Vladimir (18 November 2013). "Leaflet 0.7 Release, MapBox and Plans for Future". Retrieved 3 November 2018.
  25. ↑ Agafonkin, Vladimir (27 September 2016). "Meet Leaflet 1.0". Retrieved 3 November 2018.
  26. ↑ Liedman, Per (27 June 2017). "Announcing Leaflet 1.1.0". leafletjs.com. Retrieved 22 July 2026.
  27. ↑ Cherniavskii, Andrew (8 May 2019). "Announcing Leaflet 1.5.0". leafletjs.com. Retrieved 22 July 2026.
  28. ↑ Cherniavskii, Andrew (8 May 2019). "Announcing Leaflet 1.5.1". leafletjs.com. Retrieved 22 July 2026.
  29. ↑ Cherniavskii, Andrew (17 November 2019). "Announcing Leaflet 1.6.0". leafletjs.com. Retrieved 22 July 2026.
  30. ↑ Ortega, Iván Sánchez (4 September 2020). "Leaflet 1.7 released". leafletjs.com. Retrieved 22 July 2026.
  31. ↑ Agafonkin, Volodymyr (18 April 2022). "Leaflet 1.8 released in the middle of war". leafletjs.com. Retrieved 22 July 2026.
  32. ↑ Koops, Jon (21 September 2022). "Leaflet 1.9 released". leafletjs.com. Retrieved 22 July 2026.
  33. ↑ jonkoops (22 September 2022). "v1.9.0". github.com. Retrieved 22 July 2026.
  34. ↑ "Leaflet - a JavaScript library for interactive maps". 21 March 2022. Archived from the original on 21 March 2022. Retrieved 22 March 2022.