Auto-generalized labels on multi-layer Leaflet maps

Abstract. Leaflet is one of the most popular client-side web mapping libraries. It is lightweight, easy-to-use, especially for ones without strong programming background. The library, however, lacks a very important feature: map labels. The author developed a plugin for Leaflet that makes it easy to show map labels for any vector layer. Labels are automatically generalized to avoid overlapping texts. Point symbols or markers can be linked to their labels i.e. if the label cannot be displayed, its marker is also removed. Labels are drawn in priority order. Priorities, as well as label texts and styles can be highly customized with respect to feature/layer properties. Labels are displayed as HTML <span> elements, allowing developers to create complex labels with various borders or backgrounds as well, by CSS styling rules. The plugin extends the Map class, while label properties can be set for each layer separately. Collision conflicts are checked between layers as well. Dynamic addition/removal of map objects is also supported. Performance of the plugin was tested with 3700 map objects (mixed data of points, polygons, and lines). Updating map labels after zoom/pan required only fragments of seconds. The source code, user guide and examples are available at https://github.com/samanbey/leaflet-mapwithlabels

Authors

Institutions

Publication Details

Journal
Proceedings of the ICA
Published
2025-10-21
DOI
https://doi.org/10.5194/ica-proc-7-2-2025
Primary Topic
Data Management and Algorithms
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Auto-generalized labels on multi-layer Leaflet maps

Mátyás Gede
Proceedings of the ICA
Data Management and Algorithms
article

Auto-generalized labels on multi-layer Leaflet maps

Mátyás Gede
article en

Abstract

Abstract. Leaflet is one of the most popular client-side web mapping libraries. It is lightweight, easy-to-use, especially for ones without strong programming background. The library, however, lacks a very important feature: map labels. The author developed a plugin for Leaflet that makes it easy to show map labels for any vector layer. Labels are automatically generalized to avoid overlapping texts. Point symbols or markers can be linked to their labels i.e. if the label cannot be displayed, its marker is also removed. Labels are drawn in priority order. Priorities, as well as label texts and styles can be highly customized with respect to feature/layer properties. Labels are displayed as HTML <span> elements, allowing developers to create complex labels with various borders or backgrounds as well, by CSS styling rules. The plugin extends the Map class, while label properties can be set for each layer separately. Collision conflicts are checked between layers as well. Dynamic addition/removal of map objects is also supported. Performance of the plugin was tested with 3700 map objects (mixed data of points, polygons, and lines). Updating map labels after zoom/pan required only fragments of seconds. The source code, user guide and examples are available at https://github.com/samanbey/leaflet-mapwithlabels

Proceedings of the ICAVol. 7
Eötvös Loránd University (HU)
Openalex Percentile: Top 63%
Data Management and Algorithms
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.