Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

search-geocoding

Add a OSM search control to the map.


Description

Add a OSM search control to the map.

Removes the OSM search control from the map.

Add a Google search control to the map.

Removes the Google search control from the map.

Add a US Census Bureau search control to the map.

Removes the US Census Bureau search control from the map.

Usage

addSearchOSM(map, options = searchOptions(autoCollapse = TRUE, minLength = 2))

removeSearchOSM(map)

addReverseSearchOSM(map, showSearchLocation = TRUE, showBounds = FALSE,
  showFeature = TRUE, fitBounds = TRUE, displayText = TRUE,
  group = NULL)

addSearchGoogle(map, apikey = Sys.getenv("GOOGLE_MAP_GEOCODING_KEY"),
  options = searchOptions(autoCollapse = TRUE, minLength = 2))

removeSearchGoogle(map)

addReverseSearchGoogle(map, apikey = Sys.getenv("GOOGLE_MAP_GEOCODING_KEY"),
  showSearchLocation = TRUE, showBounds = FALSE, showFeature = TRUE,
  fitBounds = TRUE, displayText = TRUE, group = NULL)

addSearchUSCensusBureau(map, options = searchOptions(autoCollapse = TRUE,
  minLength = 20))

removeSearchUSCensusBureau(map)

Arguments

map

a map widget object

options

Search Options

showSearchLocation

Boolean. If TRUE displays a Marker on the searched location's coordinates.

showBounds

Boolean. If TRUE show the bounding box of the found feature.

showFeature

Boolean. If TRUE show the found feature. Depending upon the feature found this can be a marker, a line or a polygon.

fitBounds

Boolean. If TRUE set maps bounds to queried and found location. For this to be effective one of showSearchLocation, showBounds, showFeature shoule also be TRUE.

displayText

Boolean. If TRUE show a text box with found location's name on the map.

group

String. An optional group to hold all the searched locations and their results.

apikey

String. API Key for Google GeoCoding Service.

Value

modified map

modified map

modified map

modified map

modified map

modified map

modified map

modified map

Examples

leaflet() %>%
  addProviderTiles(providers$Esri.WorldStreetMap) %>%
  addResetMapButton() %>%
  addSearchGoogle()

## for more examples see
# browseURL(system.file("examples/search.R", package = "leaflet.extras"))

leaflet.extras

Extra Functionality for 'leaflet' Package

v1.0.0
GPL-3 | file LICENSE
Authors
Bhaskar Karambelkar [aut, cre], Barret Schloerke [aut], Bangyou Zheng [ctb] (Leaflet-search and Leaflet-GPS plugin integration), Robin Cura [ctb] (Fixes for Draw Options), Markus Voge [ctb] (Enhancements for Draw Options), Markus Dumke [ctb] (Bounce Marker addition), Mapbox [ctb, cph] (leaflet-omnivore, csv2geojson, and togeojson libraries), Henry Thasler [ctb, cph] (Leaflet.Geodesic library), Dennis Wilhelm [ctb, cph] (Leaflet.StyleEditor library), Kirollos Risk [ctb, cph] (fuse.js library), Tim Wisniewski [ctb, cph] (leaflet-choropleth library), Leaflet [ctb, cph] (leaflet-draw library), Alexander Milevski [ctb, cph] (leaflet-draw-drag library), John Firebaugh [ctb, cph] (leaflet-fullscreen library), Stefano Cudini [ctb, cph] (leaflet-gps library), Johannes Rudolph [ctb, cph] (leaflet-hash library), Per Liedman [ctb, cph] (leaflet-measure-path library), Pavel Shramov [ctb, cph] (leaflet-plugins library), Filip Zavadil [ctb, cph] (leaflet-pulse-icon library), Stefano Cudini [ctb, cph] (leaflet-search library), CliffCloud [ctb, cph] (leaflet-sleep library), Ursudio [ctb, cph] (leaflet-webgl-heatmap library), Maxime Hadjinlian [ctb, cph] (leaflet.BounceMarker library), Vladimir Agafonkin [ctb, cph] (leaflet.heat library), Iván Sánchez Ortega [ctb, cph] (leaflet.tilelayer.pouchdbcached library), Dale Harvey [ctb, cph] (pouchdb-browser library), Mike Bostock [ctb, cph] (topojson library)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.