pythonfoliumfolium-plugins

Folium plugins.FeatureGroupSubGroup: how to remove the name of the tiles from the filters box


I'm building a map with Folium. I used plugins.FeatureGroupSubGroup in order to create four subgroup so that one can filter the markers.

As you can see in the picture below, at the top of the white box there is the name of the tiles I'm using (Cartodb dark_matter).

Is there any chance to have the box without that writing? If so, how can I remove it?

Click here to see the image

I tried to search for a solution on StackOverflow and in Folium documentation but couldn't find an answer.


Solution

  • One option would be to add the TileLayer manually and turn-off its control :

    import folium
    
    m = folium.Map(location=[0, 0], zoom_start=6, tiles=None)
    t = folium.TileLayer(tiles="cartodbdark_matter", control=False).add_to(m)
    

    # irrelevant / just for reproducibility
    from folium.plugins import FeatureGroupSubGroup, MarkerCluster
    
    mcg = MarkerCluster(control=False).add_to(m)
    coordinates = [[-1, -1], [-1, 1], [1, 1], [1, -1]]
    groups = ["A", "B", "C", "D"]
    
    for coo, grp in zip(coordinates, groups):
        sg = FeatureGroupSubGroup(mcg, grp).add_to(m)
        _ = folium.Marker(coo).add_to(sg)
    
    folium.LayerControl(collapsed=False).add_to(m)
    

    Output (m) :

    enter image description here