繁体   English   中英

网站的托管数据 map

[英]Hosting data for a folium map for a website

我在 python 上用大叶创建了一个交互式 map。 我打算将其部署在网站上。

在网站上,我计划有输入字段以允许用户过滤此数据以显示在 map 上。

问:如何托管map的数据进行查询?

我认为这个问题之所以受到很多反对,是因为您添加了 javascript、html 标签,这些标签在技术上与该主题相关,但实际上并没有那么多:)

在 Folium 中,您可以使用 folium.Map.save('mymap.html') 将您的 folium map 保存为 mymap.html 文件。

这将生成一个非常大且不可读的 html 文件,其中包含许多嵌入式 javascript 代码。 Easiest way to include it to your main html file (let's say it's called index.html) is using iframe tag to import mymap.html to the main index.html

由于它会生成一个非常大的不可读 html,因此几乎不可能将其连接到主 index.html 中的输入标签。 在将其转换为 mymap.html 之前,您需要在 python 脚本中包含输入字段

我为这个问题找到了一篇完美的 Medium 文章: https://medium.com/generating-folium-maps-based-on-user-input-for-a/generating-folium-maps-based-on-user -input-for-a-dash-layout-16363da6ecd3

In short in the article, they used dash framework ( https://dash.plotly.com/ ) to make a dropdown user input fields, and then in the function that creates folium map, they put decorator called app.callback with a bunch dash.dependencies.Input 和 dash.dependencies.Output 作为@app.callback 的参数,将用户输入连接到 map。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM