Skip to content

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

Closed

Description

@robsomething

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

Activity

  1. Conengmo commented on Aug 2, 2018

    @Conengmo
    Member

    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!

  2. added
    enhancementFeature request or idea about how to make folium better
    not our bugThe bug cannot be fixed in folium but needs to be solved somewhere else
    on Aug 2, 2018
  3. Conengmo commented on Oct 12, 2018

    @Conengmo
    Member

    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

  4. added
    help wantedHelp is welcome for this issue or PR
    and removed
    not our bugThe bug cannot be fixed in folium but needs to be solved somewhere else
    on Oct 12, 2018
  5. added
    work in progressWork is in progress on a PR, check the PR to see its status
    and removed
    help wantedHelp is welcome for this issue or PR
    on Nov 7, 2022
  6. Conengmo commented on Nov 18, 2022

    @Conengmo
    Member

    This can be closed since #1637 was merged.

  7. removed
    work in progressWork is in progress on a PR, check the PR to see its status
    on Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature request or idea about how to make folium better

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions