leaflet.extras
leaflet.extras copied to clipboard
addSearchFeatures highlight multiple circles with same name
Is it possible to use the addSearchFeatures option to highlight multiple circles that share the same name?
Using the Cities example, if there were two cities with the name "Boston", but in two different locations, can the search features option highlight both of those cities? Thanks
`#' ### Search Markers
Markers ----
cities <- read.csv(textConnection(" City,Lat,Long,Pop Boston,42.3601,-71.0589,645966 Boston,41.7627,-72.6743,125017 New York City,40.7127,-74.0059,8406000 Philadelphia,39.9500,-75.1667,1553000 Pittsburgh,40.4397,-79.9764,305841 Providence,41.8236,-71.4222,177994 "))
leaflet(cities) %>% addProviderTiles(providers$OpenStreetMap) %>%
addCircles(lng = ~Long, lat = ~Lat, weight = 1, fillOpacity = 0.5,
radius = ~sqrt(Pop) * 10, popup = ~City, label = ~City, group = "cities") %>%
addResetMapButton() %>%
addSearchFeatures(
targetGroups = "cities",
options = searchFeaturesOptions(
zoom = 12, openPopup = TRUE, firstTipSubmit = TRUE,
autoCollapse = TRUE, hideMarkerOnCollapse = TRUE )) %>%
addControl("<P><B>Hint!</B> Search for ...
- New York
- Boston
- Hartford
- Philadelphia
- Pittsburgh
- Providence
Hi, I have the same question. Do you resolve the problem? Thanks!!