Display a map with points on it.

This is a wrapper around st.pydeck_chart to quickly create scatterplot charts on top of a map, with auto-centering and auto-zoom.

When using this command, Mapbox provides the map tiles to render map content. Note that Mapbox is a third-party product, the use of which is governed by Mapbox's Terms of Use.

Mapbox requires users to register and provide a token before users can request map tiles. Currently, Streamlit provides this token for you, but this could change at any time. We strongly recommend all users create and use their own personal Mapbox token to avoid any disruptions to their experience. You can do this with the mapbox.token config option.

To get a token for yourself, create an account at https://mapbox.com. For more info on how to set config options, see https://docs.streamlit.io/library/advanced-features/configuration

Function signature[source]

st.map(data=None, zoom=None, use_container_width=True)


data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None)

The data to be plotted. Must have two columns:

  • latitude called 'lat', 'latitude', 'LAT', 'LATITUDE'
  • longitude called 'lon', 'longitude', 'LON', 'LONGITUDE'.

zoom (int)

use_container_width (bool)

No description


import streamlit as st
import pandas as pd
import numpy as np

df = pd.DataFrame(
    np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
    columns=['lat', 'lon'])

(view standalone Streamlit app)

Was this page helpful?

editSuggest edits

Still have questions?

Our forums are full of helpful information and Streamlit experts.