In the following set of exercises, we will use the geo-spatial data of the Atlantic Ocean storms in 2005. The data is readily available in the leaflet package under the variable
leaflet::atlStorms2005. Each exercise is adding some more features/functionalities to the code of the previous exercise, so be sure not to discard the code until after you’re done with all of the exercises. Answers to these exercises are available here.
For other parts of the series, follow the tag leaflet.
Set the default view to longitude -47.4, latitude 39.75 and zoom level 3.
In addition, add a button that will scale back to the default view upon clicking it.
Hint: use the
icon() function from the shiny package to easily render an icon of your choice for the button.
Add the lines that represent the storms traces to the map.
Color each line according to the storm max wind.
Add a legend to the colors you just added.
Upon hovering over a line, change its weight to 10.
Upon hovering over a line, show a label with the storm name.
Upon clicking a line, show a pop-up with the storm minimum pressure.
Save your leaflet map as an HTML file.