randyzwitch / streamlit-folium

Streamlit Component for rendering Folium maps
https://folium.streamlit.app/
MIT License
444 stars 164 forks source link

Keep legend from geopandas folium object #192

Open raybellwaves opened 2 months ago

raybellwaves commented 2 months ago

Thanks for this package!

I'm trying to use this package to show a map which is from https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html

For unknown reason the legend isn't passed through.

notebook:

import geodatasets as gds
import geopandas as gpd
gdf = gpd.read_file(gds.data["naturalearth"]["land"]["url"])
gdf.explore(column="min_zoom")

Screenshot 2024-05-30 at 9 23 12 PM

streamlit:

from streamlit_folium import st_folium
import geodatasets as gds
import geopandas as gpd
gdf = gpd.read_file(gds.data["naturalearth"]["land"]["url"])
m = gdf.explore(column="min_zoom")
st_folium(m)

Screenshot 2024-05-30 at 9 25 03 PM

ShootingStarD commented 1 month ago

I have the same problem as you!

randyzwitch commented 1 month ago

Is the legend not passed through or is the map the wrong size?

raybellwaves commented 1 month ago

Is the legend not passed through or is the map the wrong size?

I think not passed through. I'll try and create a MCVE when I get some time