【问题标题】:Is it possible to add a folium map into a bokeh dashboard? Essentially, making one of the dashboard widgets a folium map是否可以将 folium 地图添加到散景仪表板中?本质上,使仪表板小部件之一成为叶地图
【发布时间】:2020-08-16 15:33:21
【问题描述】:

另一种选择是使用 bokeh 的 gmap() 函数,但如果地址已经进行了地理编码,是否可以免费使用?使用 gmap() 函数需要一个谷歌 API 密钥,但我不确定 ti 所涉及的财务影响。

p = gmap("GOOGLE_API_KEY", map_options, title="Title")

编辑:

我能够使用以下代码将 folium 地图添加到 Bokeh 仪表板中。它使用 DIV Bokeh 小部件并在该小部件内插入 iframe:

from bokeh.models import Div

output_file('dashboardWithFoliumMap.html')

mapa = Div(text="<iframe src="r'D:\MapFolder\Maps\myMap.html'" style='min-width:calc(100vw - 26px); height: 500px'><iframe>")

show(mapa)

【问题讨论】:

    标签: python gis bokeh dashboard folium


    【解决方案1】:

    用于在 Bokeh Dashboard 中嵌入叶图,

    1. 使用 folium 库创建交互式地图应用程序并将其保存为典型的 html 文档。例如:'imap.html'
    2. 使用如上所示的散景 Div 将“imap.html”嵌入到您的仪表板中。

    【讨论】:

      猜你喜欢
      • 2015-11-22
      • 2018-12-14
      • 2016-07-15
      • 2021-04-23
      • 2020-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-18
      相关资源
      最近更新 更多