Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pydeck as pdk
|
3 |
+
|
4 |
+
# Define a GeoJSON data source
|
5 |
+
geojson_data = {
|
6 |
+
"type": "FeatureCollection",
|
7 |
+
"features": [
|
8 |
+
{
|
9 |
+
"type": "Feature",
|
10 |
+
"geometry": {
|
11 |
+
"type": "Point",
|
12 |
+
"coordinates": [15.8277, -0.2280] # Republic of Congo latitude and longitude
|
13 |
+
},
|
14 |
+
"properties": {
|
15 |
+
"name": "Republic of Congo"
|
16 |
+
}
|
17 |
+
}
|
18 |
+
]
|
19 |
+
}
|
20 |
+
|
21 |
+
# Define the PyDeck layer
|
22 |
+
layer = pdk.Layer(
|
23 |
+
"GeoJsonLayer",
|
24 |
+
data=geojson_data,
|
25 |
+
get_position="geometry.coordinates",
|
26 |
+
get_radius=100000,
|
27 |
+
get_fill_color=[255, 0, 0],
|
28 |
+
pickable=True
|
29 |
+
)
|
30 |
+
|
31 |
+
# Define the PyDeck view state
|
32 |
+
view_state = pdk.ViewState(
|
33 |
+
latitude=geojson_data['features'][0]['geometry']['coordinates'][1],
|
34 |
+
longitude=geojson_data['features'][0]['geometry']['coordinates'][0],
|
35 |
+
zoom=6
|
36 |
+
)
|
37 |
+
|
38 |
+
# Define the PyDeck deck
|
39 |
+
deck = pdk.Deck(
|
40 |
+
layers=[layer],
|
41 |
+
initial_view_state=view_state,
|
42 |
+
map_style="mapbox://styles/mapbox/light-v9",
|
43 |
+
mapbox_key='YOUR_MAPBOX_API_KEY'
|
44 |
+
)
|
45 |
+
|
46 |
+
# Render the PyDeck deck using Streamlit
|
47 |
+
st.pydeck_chart(deck)
|