1. Learn
  2. /
  3. Courses
  4. /
  5. Building Dashboards with shinydashboard

Connected

Exercise

Layers of a leaflet map

As you saw earlier, leaflet maps are created in layers, not unlike a ggplot plot. The sequence of layers placed is important, since each new layer is stacked on top of existing ones.

In this exercise, you will need to complete the code below to produce the map seen in the picture.

Map for exercise.

There are four sf objects stored here as:

  • london_poly
  • london_loop
  • london_capital
  • listings_geo

The sf and tidyverse libraries have been loaded.

Instructions

100 XP
  • Import the leaflet library.
  • Use the default map provider in this map.
  • Add two polylines, one for loop_geo and one for capital_geo.
  • Add regular markers with clustered points, so that sf objects of type POINT are grouped together on the rendered map.