I cannot get streamlit/pydeck to display map layer data. When I try to print the input table and objects it all seems OK but the map loads empty. Tried tons possible scale/range combinations but hit the wall of what else could be wrong. It is expected to show a thic bar on a country level, thus the radius size. Any thoughts of what can be wrong?
Part of the csv file I am loading:
country,radku,lat,lon
ALB,1,41,20
ARE,126,24,54
ARG,24,-34,-64
AUS,103,-27,133
AUT,1217,47.3333,13.3333
AZE,2,40.5,47.5
BEL,582,50.8333,4
Data loading (loads fine with all the data, column names…):
@st.experimental_singleton
def load_data():
data = pd.read_csv(
"2022-lat-lon-summary.csv.gz",
nrows=75, # 64626 number of lines to read
names=[
"ctry",
"lines",
"lat",
"lon"
], # specify names directly since they don't change
skiprows=1, # don't read header since names specified directly
usecols=[0, 1, 2, 3],
)
return data
Display function (only displays map, no layer):
def map(data, lat, lon, zoom):
st.write(
pdk.Deck(
map_style="mapbox://styles/mapbox/light-v11",
initial_view_state={
"latitude": lat,
"longitude": lon,
"zoom": zoom,
"pitch": 50,
},
layers=[
pdk.Layer(
"HexagonLayer",
data=data,
get_position=["lon", "lat"],
auto_highlight = True,
radius=70000,
elevation_scale=1,
elevation_range=[0, 2000], #reduced from 20000 as max in data is 16k for forum post
pickable=True,
extruded=True,
getElevationValue =["lines"]
)
],
)
)