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

Branca colormap caption with apostrophe makes map does not show #111

Closed
iladan0 opened this issue May 18, 2022 · 1 comment · Fixed by #117
Closed

Branca colormap caption with apostrophe makes map does not show #111

iladan0 opened this issue May 18, 2022 · 1 comment · Fixed by #117
Labels

Comments

@iladan0
Copy link

iladan0 commented May 18, 2022

Describe the bug
When the caption of the colormap contains an apostrophe, the folium map does not show (I get a white rectangle)

To Reproduce

mymap= folium.Map(tiles = "Stamen Toner")

colormap = branca.colormap.LinearColormap(['red','yellow', 'green'], vmin=0.0, vmax=5.0)
colormap.caption = "Agency's rating"
colormap.add_to(mymap)

mymap

Expected behavior
The expected behavior is to get a folium map with red to green colormap having the caption "Agency's rating" but i got a white rectangle

Environment (please complete the following information):

  • Browser chrome and edge
  • Jupyter lab
  • Python version 3.9.10
  • folium version 0.12.1.post1
  • branca version 0.4.2

Additional context
The code works perfectly fine if the caption does not have an apostrophe.

Possible solutions
List any solutions you may have come up with.

folium is maintained by volunteers. Can you help making a fix for this issue?

@Conengmo Conengmo added the bug label May 18, 2022
@Conengmo
Copy link
Member

Thanks for the report! This is indeed an issue in branca's colormap functionality.

Looking into it very shortly, the issue seems to be in https://github.com/python-visualization/branca/blob/master/branca/templates/color_scale.js. My first intuition is to use Jinja2's tojson filter, which we use throughout folium already for the same purpose.

@Conengmo Conengmo transferred this issue from python-visualization/folium May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants