The goal of {leaf.magic} is to overcome the somewhat outdated "Font Awesome" implementation in vanilla R {leaflet} by constructing markers on the fly using {fontawesome} or {bsicons} and {magick}. There are three issues {leaf.magic} sets out to overcome:
-
leaflet::awesomeIcons()is limited to Font Awesome 4 👎 -
leaflet::awesomeIcons()is limited to a handful of discrete colours 👎 -
leaflet::awesomeIcons()is limited to a single marker size 👎 -
Vanilla
{leaflet}doesn't provide any additional features to construct legends, icon palettes, or such like 👎
{leaf.magic} attempts to solve all of this:
-
magicIcons()uses up-to-date versions of Font Awesome, Bootstrap, and Ionicons Icons, powered by{fontawesome}and{bsicons}✅ -
magicIcons()uses{fontawesome}to grab a marker shape, and can therefore colour and resize it however the user desires ✅ -
{leaf.magic}exports functions likeiconBin()andaddIconLegend()to help developers communicate the meanings of icons to users ✅
{leaf.magic} is thoroughly documented on the package website, which includes a getting started guide.
You can install the development version of {leaf.magic} like so:
# install.packages("pak")
pak::pak("jack-davison/leaf.magic"){leaf.magic} is licensed under the MIT License, and would not be possible without the following icon libraries:
-
Font Awesome - Website | License | R Package {fontawesome}
-
Bootstrap Icons - Website | License | R Package {bsicons}
Please note that the leaf.magic project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

