setting the zoom level to 7.25 in shiny leaflet r

℡╲_俬逩灬. 提交于 2021-02-08 11:07:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!