python-visualization / python-visualization/folium
GlifyLayer not defined when using .add_to(map)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 7.4k
- Forks
- 2.3k
- Ø Merge
- 17 Std. 22 Min.
- Gemergte PRs (30 T.)
- 11
Beschreibung
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)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit GlifyLayer.ipynb und untersuche das generierte HTML sowie die Browserkonsole. Verfolge, wie GlifyLayer.add_to(map) sowohl den Aufruf L.glify.layer(options).addTo(...) als auch den Aufruf glify_layer_xxxxxx.addTo(...) erzeugt, einschließlich der Implementierung von GlifyLayer init.py. Fertig ist die Aufgabe, wenn das generierte HTML eine Layer-Einrichtung ausgibt und der Rest der Karte ohne den ReferenceError geladen wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100