leaflet.extras icon indicating copy to clipboard operation
leaflet.extras copied to clipboard

addSearchFeatures highlight multiple circles with same name

Open noshealcrix opened this issue 5 years ago • 2 comments

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
</P>", position = "bottomright")`

noshealcrix avatar Aug 08 '18 14:08 noshealcrix

Hi, I have the same question. Do you resolve the problem? Thanks!!

SNoboa avatar Oct 27 '20 18:10 SNoboa