setView
From leaflet v1.0.0
by Joe Cheng
Methods to manipulate the map widget
A series of methods to manipulate the map.
Usage
setView(map, lng, lat, zoom, options = list())fitBounds(map, lng1, lat1, lng2, lat2)
setMaxBounds(map, lng1, lat1, lng2, lat2)
clearBounds(map)
Arguments
- map
- a map widget object created from
leaflet()
- lng
- The longitude of the map center
- lat
- The latitude of the map center
- zoom
- the zoom level
- options
- a list of zoom/pan options (see
http://leafletjs.com/reference.html#map-zoompanoptions ) - lng1, lat1, lng2, lat2
- the coordinates of the map bounds
Value
- The modified map widget.
Functions
setView
: Set the view of the map (center and zoom level)fitBounds
: Set the bounds of a mapsetMaxBounds
: Restricts the map view to the given boundsclearBounds
: Clear the bounds of a map, and the bounds will be automatically determined from latitudes and longitudes of the map elements if available (otherwise the full world view is used)
References
Examples
library(leaflet)
m = leaflet() %>% addTiles() %>% setView(-71.0382679, 42.3489054, zoom = 18)
m # the RStudio 'headquarter'
m %>% fitBounds(-72, 40, -70, 43)
m %>% clearBounds() # world view
Community examples
Looks like there are no examples yet.