Adds a geocoding search widget to a leaflet map using the leaflet-geosearch plugin. Supports multiple providers such as OpenStreetMap, Esri, Google, HERE, etc.
Usage
addGeosearch(map, provider = geosearchProvider(), options = geosearchOptions())
Arguments
- map
a map widget
- provider
A provider list object created with e.g.
geosearchProvider
- options
A list of control options created with
geosearchOptions
.
Shiny value
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 thegeosearch/showlocation
event). Returns a list withlat
,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 thegeosearch/marker/dragend
event). Returns the same structure as above.
Both values are NULL
if no result is available.
See also
Other Geosearch Functions:
geosearchOptions()
,
removeGeosearch()