Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GlifyLayer not defined when using .add_to(map) #1982

Open
Doyley1 opened this issue Jun 27, 2024 · 3 comments
Open

GlifyLayer not defined when using .add_to(map) #1982

Doyley1 opened this issue Jun 27, 2024 · 3 comments
Labels
not our bug The bug cannot be fixed in folium but needs to be solved somewhere else work in progress Work is in progress on a PR, check the PR to see its status

Comments

@Doyley1
Copy link
Contributor

Doyley1 commented Jun 27, 2024

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)

@Conengmo
Copy link
Member

Thanks for the bug report! This is an issue in a downstream plugin. I opened a fix there: onaci/folium-glify-layer#3

@Conengmo Conengmo added bug An issue describing unexpected or malicious behaviour not our bug The bug cannot be fixed in folium but needs to be solved somewhere else work in progress Work is in progress on a PR, check the PR to see its status labels Jun 28, 2024
@Doyley1
Copy link
Contributor Author

Doyley1 commented Jun 28, 2024

Thanks for working on the fix :) any chance that documentation on this plugin can be added? Currently only mentioned within the ReadMe.md

@Conengmo
Copy link
Member

No problem! About the documentation though, it’s not our plug-in, so you’d have to ask in the downstream repo.

@Conengmo Conengmo removed the bug An issue describing unexpected or malicious behaviour label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not our bug The bug cannot be fixed in folium but needs to be solved somewhere else work in progress Work is in progress on a PR, check the PR to see its status
Projects
None yet
Development

No branches or pull requests

2 participants