Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

GlifyLayer not defined when using .add_to(map)

未關閉
#1,982 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
javascript, python

研究方向

從 GlifyLayer.ipynb 開始,檢查產生的 HTML 和瀏覽器主控台。追蹤 GlifyLayer.add_to(map) 如何同時產生 L.glify.layer(options).addTo(...) 呼叫和 glify_layer_xxxxxx.addTo(...) 呼叫,包括 GlifyLayer init.py 的實作。完成的標準是產生的 HTML 只輸出一個圖層設定,且地圖的其餘部分能在沒有 ReferenceError 的情況下載入。

由索引模型根據 Issue 內容生成。

描述

not our bug work in progress

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)

主要語言
Python
星號
7.4k
分支
2.3k
平均合併
17 小時 22 分鐘
30 天內合併 PR
11

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

python-visualization/folium 的其他 Issue

查看 python-visualization/folium 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。