我已经在地质公园中创建了一个具有探索性()函数的地图,但是我想要修复缩放级别,并禁用鼠标盘。
我试过以下几种方法
merged1.explore(
column="department", # make choropleth based on "department" column
tooltip="decision_type", # show "decision_type" value in tooltip (on hover)
popup=True, # show all values in popup (on click)
tiles="CartoDB positron", # use "CartoDB positron" tiles
cmap="Set1", # use "Set1" matplotlib colormap
style_kwds=dict(color="black"), # use black outline
zoom_control=False,
)zoom_control=False禁用缩放按钮,但我还不能禁用滚动或平移缩放。我尝试将dragging=False和scroll_wheel_zoom=False添加到参数中,但没有起作用。
如何将这些参数传递给folium对象和/或传单以实现我的目标?
发布于 2022-01-21 09:57:04
如果您查看一下explore.py在geopandas包中,您会发现有一个传递给folium //的源源不断的kwargs列表
使用您想要使用的传单https://leafletjs.com/reference-1.6.0.html#map中定义的参数扩展此列表允许您从explore()调用中传递它们。
下面显示的是摇摄和缩放已经完全禁用。
import geopandas as gpd
import geopandas.explore
geopandas.explore._MAP_KWARGS += ["dragging", "scrollWheelZoom"]
world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
world.loc[world["continent"].eq("Europe") & ~world["iso_a3"].isin(["RUS","-99"])].explore(
# m=m,
column="gdp_md_est", # make choropleth based on "department" column
tooltip="name", # show "decision_type" value in tooltip (on hover)
popup=True, # show all values in popup (on click)
tiles="CartoDB positron", # use "CartoDB positron" tiles
cmap="Set1", # use "Set1" matplotlib colormap
style_kwds=dict(color="black"), # use black outline
zoom_control=False,
dragging=False,
scrollWheelZoom=False
)https://stackoverflow.com/questions/70795378
复制相似问题