Research address plug-in for leaflet map for shiny app

Good morning community,

I would like to know if anyone knows of the existence of a library or function that can allow me to insert an address search bar inside a leaflet map.
Obviously the whole thing is inside a shiny app.


I suggest you use leaflet.extras::addSearchOSM() function; it will search using Open Street Map geocoding API, which is open source and in most cases very reliable.

In theory leaflet.extras::addSearchGoogle() would be also a valid option, allowing search via Google geocoding engine. But this would require obtaining and managing an API key from Google and is a paid service.

For an example consider this code:


# plot a map, any map... (blank in this case)
leaflet() %>% 
  addProviderTiles("Stamen.Toner") %>% 
  leaflet.extras::addSearchOSM(options = searchOptions(collapsed = FALSE))

The map is initially blank (showing whole world) and the address shown was located via the Search window.

This will work both in context of a standalone leaflet map and a shiny app (i.e. embedding in shiny is not required for this feature to work).


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.