# Maps streamlit

**URL:** <https://discuss.streamlit.io/t/maps-streamlit/27338>\
**Category:** Using Streamlit\
**Created:** [July 5, 2022, 7:16am UTC](https://discuss.streamlit.io/t/maps-streamlit/27338 "2022-07-05T07:16:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amira\_RIAHI](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/amira_riahi/32/16640_2.png) [@Amira\_RIAHI](https://discuss.streamlit.io/u/Amira_RIAHI)\
**Post date:** [July 5, 2022, 7:16am UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/1 "2022-07-05T07:16:01Z")

</div>

Hi,  
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

```auto
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")
st.map(couche)

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)

```

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [July 7, 2022, 5:07pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/2 "2022-07-07T17:07:19Z")

</div>

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 `st.pyplot(couche)` instead?

Best,  
Randy

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/franky1/32/6509_2.png) [@Franky1](https://discuss.streamlit.io/u/Franky1)\
**Post date:** [July 7, 2022, 6:30pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/3 "2022-07-07T18:30:35Z")

</div>

Double posting:

> [Help st.map please!](https://discuss.streamlit.io/t/help-st-map-please/27452)

---

<div class="post-metadata">

**Author:** ![Amira\_RIAHI](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/amira_riahi/32/16640_2.png) [@Amira\_RIAHI](https://discuss.streamlit.io/u/Amira_RIAHI)\
**Post date:** [July 7, 2022, 7:30pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/4 "2022-07-07T19:30:36Z")

</div>

Hi randyzwitch,  
Thank you,  
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

Regards,

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/franky1/32/6509_2.png) [@Franky1](https://discuss.streamlit.io/u/Franky1)\
**Post date:** [July 7, 2022, 7:51pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/5 "2022-07-07T19:51:57Z")

</div>

As i already wrote, i think this problem is `geopandas` related.

- You are running streamlit locally on windows i assume?
- Which python version?
- Can you share your code or your geojson file?

---

<div class="post-metadata">

**Author:** ![Amira\_RIAHI](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/amira_riahi/32/16640_2.png) [@Amira\_RIAHI](https://discuss.streamlit.io/u/Amira_RIAHI)\
**Post date:** [July 7, 2022, 8:14pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/6 "2022-07-07T20:14:23Z")

</div>

Hi Franky,  
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,

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/franky1/32/6509_2.png) [@Franky1](https://discuss.streamlit.io/u/Franky1)\
**Post date:** [July 7, 2022, 9:25pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/7 "2022-07-07T21:25:40Z")

</div>

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:

```python
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 `plotly` or `pydeck` and their corresponding streamlit elements:

> [Chart elements - Streamlit Docs](https://docs.streamlit.io/library/api-reference/charts)

---

<div class="post-metadata">

**Author:** ![Amira\_RIAHI](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/amira_riahi/32/16640_2.png) [@Amira\_RIAHI](https://discuss.streamlit.io/u/Amira_RIAHI)\
**Post date:** [July 9, 2022, 3:24pm UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/8 "2022-07-09T15:24:43Z")

</div>

Hi Franky1,  
Using pydeck was the solution because i was able to add layers ☺  
Thanks !!

---

<div class="post-metadata">

**Author:** ![BeyondMyself](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/beyondmyself/32/7525_2.png) [@BeyondMyself](https://discuss.streamlit.io/u/BeyondMyself)\
**Post date:** [July 10, 2022, 3:16am UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/9 "2022-07-10T03:16:07Z")

</div>

you also can try streamlit-folium package

package url:

> **[GitHub - randyzwitch/streamlit-folium: Streamlit Component for rendering...](https://github.com/randyzwitch/streamlit-folium)**
>
> Streamlit Component for rendering Folium maps. Contribute to randyzwitch/streamlit-folium development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [July 10, 2023, 3:16am UTC](https://discuss.streamlit.io/t/maps-streamlit/27338/10 "2023-07-10T03:16:49Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
