ArticleslgStudy

computer science

Leaflet (software)

Leaflet (software) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Leaflet (software) rather than just read about it. In short: 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.

Leaflet (software) — main illustration
Leaflet (software) — illustration

Key takeaways

  • Leaflet (software) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Leaflet (software) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Leaflet (software) from memory before moving on to harder problems.

Reference excerpt

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 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:

Raster types (TileLayer and ImageOverlay) Vector types (Path, Polygon, and specific types such as Circle) Grouped types (LayerGroup, FeatureGroup and GeoJSON) Controls (Zoom, Layers, etc.) 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.

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. 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.

0.1: 17 May 2011 0.2: 18 June 2011 0.3: 14 February 2012 0.4: 30 July 2012 0.5: 17 January 2013 This release introduced Retina support and many usability and user experience improvements. 0.6: 26 June 2013 This release expanded the API's range of methods and events, improved usability, and added GeoJSON saving. It was completed in a 2-day code sprint supported by Mapbox. 0.7: 22 November 2013 This release focused on bug fixing, announcing that refactoring and potential backward incompatibilities would come soon. 1.0: 27 September 2016 This release contained over 400 changes compared to v0.7.7: Performance improvements in all aspects of the library and vector layers in particular. Flyover animations (zooming and panning in a curve). Fractional zoom level support. Better tile loading algorithm with less flickering. Custom pane management (including multiple vector layer panes and interleaving vectors and tile layers). Better support for non-standard projections. More accessibility features. Improved documentation. Stability improvements. 1.1: 27 June 2017 This release adds video overlays and makes a transition to ECMAScript 6 modules. 1.2: 25 October 2017 1.3: 15 January 2018 1.3.2: 17 July 2018 1.3.3: 18 July 2018 1.3.4: 21 August 2018 1.4.0: 30 December 2018 1.5.0 and 1.5.1: 8 May 2019 1.6.0: 17 November 2019 1.7.0 and 1.7.1: 4 September 2020 1.8: 18 April 2022 1.9: 22 September 2022 In March 2022, the developer urged action on the Russian invasion of Ukraine on the Leaflet website.

References

External links Official website Leaflet Tutorials Maps for Leaflet TileLayer openstreetmap:leaflet

Free web app made with Leaflet: embedMap

Illustrations

Leaflet (software): A basic demo using Leaflet.
A basic demo using Leaflet.

Worked examples

Example 1 — a first encounter with Leaflet (software)

Start with the simplest possible case. Write down what Leaflet (software) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Leaflet (software) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Leaflet (software) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Leaflet (software)

In research
Leaflet (software) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Leaflet (software) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Leaflet (software) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Free GIS software, Free software programmed in JavaScript, Geographical technology, so understanding it makes those chapters shorter.
In everyday life
Look for Leaflet (software) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Leaflet (software)” →

How to study Leaflet (software) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Leaflet (software) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Leaflet (software) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Leaflet (software) in simple terms?

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.

Why does Leaflet (software) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Leaflet (software)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Leaflet (software).

Tags

  • Free GIS software
  • Free software programmed in JavaScript
  • Geographical technology
  • JavaScript libraries
  • Keyhole Markup Language
  • Software using the BSD license
  • Web mapping

Keep exploring