From the course: Creating Maps with R

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Add labels and pop-ups to Leaflet maps

Add labels and pop-ups to Leaflet maps

From the course: Creating Maps with R

Add labels and pop-ups to Leaflet maps

- [Instructor] Interactive maps are really awesome because they allow us to provide additional information to readers when they interact with the map. In a leaflet package we have two different ways to add this kind of information with labels and popups. Labels appear when a user hovers their cursor over a feature in a map, whereas popups show when a user deliberately clicks a feature in a map. These kinds of interactions were all built decades before touchscreen devices were even a consideration. Today, we need to think about how the interactive maps we build will work on mobile devices. There simply is no difference on a touchscreen between hovering or clicking a map. The simplest advice I can give you is to avoid combining both labels and popups in the same leaflet map. It's also important to note that you can only customize the appearance of popups with HTML. It's not possible to do so with hover labels in the…

Contents