python-visualization / python-visualization/folium

GlifyLayer not defined when using .add_to(map)

オープン
#1,982 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

not our bug work in progress
主要言語
Python
スター
7.4k
フォーク
2.3k
平均マージ
17時間 22分
マージ済み PR(30日)
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)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

GlifyLayer.ipynb から始めて、生成された HTML とブラウザコンソールを調査します。GlifyLayer.add_to(map) が L.glify.layer(options).addTo(...) の呼び出しと glify_layer_xxxxxx.addTo(...) の呼び出しの両方を生成する仕組みを、GlifyLayer init.py の実装も含めて追跡します。生成された HTML から 1 つのレイヤーセットアップが出力され、マップの残りの部分が ReferenceError なしで読み込まれれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。