For example, I made a simple leaflet
based map using tmap
package. The result is an html with interactive map, showing some polygons of buildings (find data, code and the map itself here).
I want polygons to be highlighted someway when selected by html user by mouse click, like it is in QGIS (screenshot adjusted). Is there a way to do such thing in R?
You may consider switching over to library(leaflet)
map <- tm_shape(buildings) +
tm_polygons(col = "#ff00bf")
leaflet(data = buildings) %>%
addPolygons(highlightOptions = highlightOptions(color = "yellow",
weight = 2,
fillColor = 'yellow',
bringToFront = TRUE))