Chapter 4. Creating Custom Markers

In Chapter 3, Creating Heatmaps and Choropleth Maps, you learned how to style your maps to create a heatmap and a choropleth map. Leaflet allows you to further customize the style of your map by modifying the default markers. In this chapter, you will learn how to style markers by creating custom marker icons. You will also learn about the available marker plugins for styles and effects.

Creating a custom marker

In Leaflet, a marker is made from two images: an image that represents the marker and a second image that serves as the shadow to create depth. When you download Leaflet, there is an images folder. This folder contains the default marker: the blue pin that you have seen in your maps and a small shadow image. ...

Get Leaflet.js Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.