Skip to content

Font Awesome fonts built under version 5 don't render in folium 0.5.0 #923

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

Closed
robsomething opened this issue Jul 30, 2018 · 3 comments
Closed
Labels
enhancement Feature request or idea about how to make folium better

Comments

@robsomething
Copy link

Hi, I can't get the FA icons to render if they have a prefix other than "fa". FA built out a bunch of new ones and reclassified many of the older ones.

mapout=folium.Map(location=[33.46,-111.79], zoom_start=7, tiles="OpenStreetMap", control_scale = True) 
v = {'latitude': 34, 'longitude': -115, 'ID': 12345}
w = {'latitude': 34.5, 'longitude': -114.5, 'ID': 12346}
iconprefix = 'fab'
iconname='fa-cloudversify'
iconcolor='green'

label ='Customer ID: ' +str(v['ID'])+'<br>'           
pointpopup = folium.Popup(IFrame(label, width = 300, height = 150))
fga=folium.FeatureGroup(name="Active Customers") #add a group of features to a single object
fga.add_child(folium.Marker(location=[float(v['latitude']),float(v['longitude'])], popup=pointpopup , \
                                      icon=folium.Icon(color=iconcolor,prefix= iconprefix, icon=iconname)))

iconprefix = 'fa'
iconname='fa-shopping-cart'
iconcolor='green'
label ='Customer ID: ' +str(w['ID'])+'<br>'           
pointpopup = folium.Popup(IFrame(label, width = 300, height = 150))
fga.add_child(folium.Marker(location=[float(w['latitude']),float(w['longitude'])], popup=pointpopup , \
                                      icon=folium.Icon(color=iconcolor,prefix= iconprefix, icon=iconname)))
mapout.add_child(fga) #add the group/layer of addresses
mapout.add_child(folium.LayerControl()) #add layer control after all layers added
mapout.save('mapout.html') 
[mapout.txt](https://github.com/python-visualization/folium/files/2242508/mapout.txt)

Problem description

Font Awesome icons with prefixes other than 'fa' do not render in popup markers, when using folium 0.5.0. According to a response from the FA help desk:
"It looks like folium is using Font Awesome version 4, so those prefixes won't work. Folium will need to be updated for version 5."

Expected Output

icon to lower left should have a small cloud. icon to upper right should have a shopping cart. ticket includes an .html file renamed as .txt for uploading purposes

Output of folium 0.5.0

Lower left icon is missing. Upper right shopping cart is showing.
image

@Conengmo
Copy link
Member

Conengmo commented Aug 2, 2018

Thanks for pointing this out. I just looked into it a bit and indeed folium is using version 4. Do we want to move to 5?

We're using a Leaflet plugin for the markers:
https://github.com/lvoogdt/Leaflet.awesome-markers
This library is made for FA version 4 and it won't work with version 5, because it uses the prefix argument for both the loose fa and the fa-icon-name. The library isn't being actively maintained and PR's don't seem to get accepted, so I'm not sure how we can solve this.

The library was more recently updated on this fork, but still no FA v.5 support.
https://github.com/sigma-geosistemas/Leaflet.awesome-markers

So it seems we're stuck with FA v.4 for now. Unless maybe...

  • the Leaflet.awesome-markers library becomes active again, or
  • we find a fork of it that is being sufficiently maintained, or
  • we find another marker library, or
  • we implement it ourselves in folium

folium is maintained by volunteers so ideas or help is welcome!

@Conengmo Conengmo added enhancement Feature request or idea about how to make folium better not our bug The bug cannot be fixed in folium but needs to be solved somewhere else labels Aug 2, 2018
@Conengmo
Copy link
Member

Conengmo commented Oct 12, 2018

Hi @robsomething, we recently forked the awesome marker library to take control of updating it. You're very welcome to contribute to it if you have the time! @rougeth will help out maintaining it. I think right now PR's that add FA 5 support are welcome. You can probably look into other forks to see how others did it. We'll then have to patch folium to work with the changes.

https://github.com/python-visualization/Leaflet.awesome-markers

@Conengmo Conengmo added help wanted Help is welcome for this issue or PR and removed not our bug The bug cannot be fixed in folium but needs to be solved somewhere else labels Oct 12, 2018
@Conengmo Conengmo added work in progress Work is in progress on a PR, check the PR to see its status and removed help wanted Help is welcome for this issue or PR labels Nov 7, 2022
@Conengmo
Copy link
Member

This can be closed since #1637 was merged.

@Conengmo Conengmo removed the work in progress Work is in progress on a PR, check the PR to see its status label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or idea about how to make folium better
Projects
None yet
Development

No branches or pull requests

2 participants