问题
Using leaflet function within the shiny context, I have been able to create a great interactive map. I would like to set the zoom to somewhere between 7 and 7.5 (e.g., 7.25). I tried to do so as is shown in the code below but the zoom level in the map remained unchanged. It appears that one can set the zoom level to either 7 or 7.5 not anything between these numbers. How can fix this? Thanks.
setView(-82.706838, 40.358615, zoom=7.25)
回答1:
Use leaflet map options:
- zoomSnap: how small you can define the zoom level.
- zoomDelta: how much the view zooms when clicking zoom control buttons
leaflet(options = leafletOptions(zoomSnap = 0.25, zoomDelta=0.25)) %>%
addTiles()%>%
setView(lng=-82.706838, lat=40.358615, zoom=7.25)
来源:https://stackoverflow.com/questions/62862639/setting-the-zoom-level-to-7-25-in-shiny-leaflet-r