python-visualization / python-visualization/folium
GlifyLayer not defined when using .add_to(map)
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 7.4k
- 派生
- 2.3k
- 平均合并
- 17 小时 22 分钟
- 30 天内合并 PR
- 11
描述
When using GlifyLayer.add_to(map) an error appears:
Uncaught ReferenceError: glify_layer_xxxxxx is not defined
The issue being that calling add_to(map) generates the function twice
L.glify.layer(options).addTo(map_xxxxxx);
glify_layer_xxxxxx.addTo(map_xxxxxx);
This prevents the rest of the map loading correctly.
To Reproduce
This can be reproduced using the GlifyLayer.ipynb by saving the resultant html to file and inspecting console
Environment:
- Python version 3.12.4
- folium version 0.17.0
Possible solutions
A workaround I have been implementing is to directly change the HTML directly by setting
var glify_layer_xxxxxx = L.glify.layer(options);
glify_layer_xxxxxx.addTo(map_xxxxxx);
folium is maintained by volunteers. Can you help making a fix for this issue?
Unsure of where the generation of the 2nd function glify_layer_xxxxxx.addTo(map_xxxxxx); is taking place, clearly not in init.py for GlifyLayer (Maybe constructor for GlifyLayer, but cannot be sure)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 GlifyLayer.ipynb 开始,检查生成的 HTML 和浏览器控制台。跟踪 GlifyLayer.add_to(map) 如何同时生成 L.glify.layer(options).addTo(...) 调用和 glify_layer_xxxxxx.addTo(...) 调用,包括 GlifyLayer init.py 的实现。完成的标准是生成的 HTML 只输出一个图层设置,并且地图的其余部分能够在没有 ReferenceError 的情况下加载。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100