awacke1's picture
Update app.py
f85ba44
raw
history blame
1.2 kB
import streamlit as st
import pydeck as pdk
# Define a GeoJSON data source
geojson_data = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [15.8277, -0.2280] # Republic of Congo latitude and longitude
},
"properties": {
"name": "Republic of Congo"
}
}
]
}
# Define the PyDeck layer
layer = pdk.Layer(
"GeoJsonLayer",
data=geojson_data,
get_position="geometry.coordinates",
get_radius=100000,
get_fill_color=[255, 0, 0],
pickable=True
)
# Define the PyDeck view state
view_state = pdk.ViewState(
latitude=geojson_data['features'][0]['geometry']['coordinates'][1],
longitude=geojson_data['features'][0]['geometry']['coordinates'][0],
zoom=6
)
# Define the PyDeck deck
deck = pdk.Deck(
layers=[layer],
initial_view_state=view_state,
map_style="mapbox://styles/mapbox/light-v9",
mapbox_key='pk.eyJ1IjoiYWFyb253YWNrZXIiLCJhIjoiY2xlOGV2enN3MGV0YzN2bzZjMm96eXhyOSJ9.SqZugs5uIpIBvMM_Hioyvg'
)
# Render the PyDeck deck using Streamlit
st.pydeck_chart(deck)