Is there any way to get custom marker icons for leaflet in R? I have tried using the example code provided in the tutorial however the makeIcon function does not appear to exist. The code I tried is here but it didn't work.
http://rstudio.github.io/leaflet/markers.html
Any suggestions would be much appreciated. The overall aim is to implement this into a shiny web application.
Many Thanks
The makeIcon
function does exist, at least in my leaflet package..
The following code (from the tutorial) works fine for me..
greenLeafIcon <- makeIcon(
iconUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png",
iconWidth = 38, iconHeight = 95,
iconAnchorX = 22, iconAnchorY = 94,
shadowUrl = "http://leafletjs.com/examples/custom-icons/leaf-shadow.png",
shadowWidth = 50, shadowHeight = 64,
shadowAnchorX = 4, shadowAnchorY = 62
)
leaflet(data = quakes[1:20,]) %>% addTiles() %>%
addMarkers(~long, ~lat, ~as.character(mag), icon = greenLeafIcon)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With