| addGeosearch | R Documentation |
Adds a geocoding search widget to a leaflet map using the leaflet-geosearch plugin. Supports multiple providers such as OpenStreetMap, Esri, Google, HERE, etc.
addGeosearch(map, provider = geosearchProvider(), options = geosearchOptions())
map |
a map widget |
provider |
A provider list object created with e.g. |
options |
A list of control options created with |
the new map object
When used inside a Shiny application, addGeosearch() will also register
two reactive inputs that return the most recent geosearch results:
input$<mapId>_geosearch_result
Updated when a search result is selected (from the
geosearch/showlocation event). Returns a list with
lat, lng, label, bounds, and other properties
provided by the geocoder.
input$<mapId>_geosearch_dragend
Updated when the marker placed by the geosearch control is dragged to a
new location (from the geosearch/marker/dragend event). Returns the
same structure as above.
Both values are NULL if no result is available.
https://github.com/smeijer/leaflet-geosearch
Other Geosearch Functions:
geosearchOptions(),
removeGeosearch()
library(leaflet)
library(leaflet.extras2)
leaflet() %>%
addTiles() %>%
addGeosearch()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.