python-visualization / python-visualization/folium
How to add a fixed position (in screen) static custom Text (html) like Legend
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 7.4k
- 派生
- 2.3k
- 平均合并
- 17 小时 22 分钟
- 30 天内合并 PR
- 11
描述
Is your feature request related to a problem? Please describe.
Is there a way to just insert some overlay into the map with custom html code? Like legend but with descriptions or titles and such?
Describe the solution you'd like
There are clearly the elements like Layer control, Minimaps and such that are overlaid in the map, so I feel like there should be a way to put some boxes there with some custom contents. The contents can be static (generated from python string)
I'd prefer to do it with just a python string passed to some python function, without the need to write js or css ourselves if possible.
Describe alternatives you've considered
- I've tried to make a jinja template and put the html file contents in a template, but didn't work with the html made from the map being something that needs to be inside iframe.
- I tried to edit the html myself, but the map is generated from javacript.
- I tried to add the element in the
map.get_root()but it puts that on top, and if I use css to make it a overlay (I'm not good with it), then it somehow ends up below the map and invisible.
Additional context
I went through some issues thinking it should be there but didn't find anywhere.
https://github.com/python-visualization/folium/issues/86 says there used to be a custom map template you could make but it's gone now.
https://github.com/transport-nantes/tn_web/issues/135
https://github.com/python-visualization/folium/issues/781
Implementation
I'm not good with css or js, but I can do some python dev. If there is a easy way to just copy some parts from the LayerControl or such and add it, then I can help.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读现有的 LayerControl 实现和 issue 中提到的 map.get_root() 入口点,以及链接的先前 issue。确定如何在不需要自定义 JavaScript 或 CSS 的情况下,将 Python 提供的静态 HTML 覆盖层定位在地图上方。完成的标准是该功能在生成的地图输出中正常工作,并支持所请求的固定位置内容。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- css, html, javascript, python
- 领域
- data-visualization, frontend, web-dev
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100