sensebox / opensensmapR

R client for opensensemap.org
https://noerw.github.io/opensensmapR/inst/doc/osem-history
8 stars 5 forks source link

Add senseBox icon for leafletr #14

Open nuest opened 6 years ago

nuest commented 6 years ago

You can easily create an icon matching the openSenseMap with leafletr, it could be helpful for users to provide the icon with a function in this package.

sense_icon <- awesomeIcons(
  icon = 'cube',
  iconColor = '#ffffff',
  library = 'fa',
  markerColor = 'green'
)

leaflet() %>% 
  addTiles() %>%
  addAwesomeMarkers(data = osem_boxes(), # ms_boxes,
             popup = ~paste0("<b>Name:</b> ", name, "<br><b>Id:</b> ", 
                             "<a href='https://opensensemap.org/explore/", X_id, "' ",
                             "target='_blank'>", X_id, "</a>"),
             label = ~name,
             icon = sense_icon)

giving

image

nuest commented 6 years ago

If not a function, this could also go into a short vignette for creating a leaflet map, vignettes/osem-leaflet.Rmd - happy to create a PR if welcome.

noerw commented 6 years ago

:+1: A leaflet / interactive visualization vignette sounds more reasonable than adding this to the base package.