How can i add maps ploted based on geojson data (long and lat) to my streamlit app please?
I need a layer with “zone clim” column
couche = gpd.read_file('C:/Users/xxx/chambre/carte.geojson')
couche.plot(column = 'ZONE_2022' ,cmap = 'cool', legend = True, figsize = (5,5))
plt.title("zones climatiques 2022")
CRSError: Invalid projection: epsg:4326: (Internal Proj Error: proj_create: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name)
Hi @Amira_RIAHI, welcome to the Streamlit community!
In this example,
st.map only takes in a dataframe with lat/lon coordinates, whereas you are passing in a
plot method. Did you mean to call
Yes i tried both st.map and st.pyplot since i need to add a plot with layers to my app
I find streamlit quite simple to use except when dealing with geopandas
As i already wrote, i think this problem is
- You are running streamlit locally on windows i assume?
- Which python version?
- Can you share your code or your geojson file?
I was trying to update geopandas to see if it will work
i’m using streamlit locally on windows. and my Python version is 3.9.7
Thanks for help,
Without seeing actual code or data, i can only guess.
Here is a simple example to load a
geojson file with point data and show it on a streamlit app:
df = gpd.read_file('cities.geojson')
df['lon'] = df.geometry.x # extract longitude from geometry
df['lat'] = df.geometry.y # extract latitude from geometry
df = df[['lon','lat']] # only keep longitude and latitude
st.write(df.head()) # show on table for testing only
st.map(df) # show on map
Edit: Be aware that with
st.map you can only show point data, for other geospatial data you have to use other libraries/elements for example
pydeck and their corresponding streamlit elements:
Chart elements - Streamlit Docs
Using pydeck was the solution because i was able to add layers
you also can try streamlit-folium package