Hi,
My code:
view_state = pdk.ViewState(latitude=32,
longitude=35,
zoom=7,
pitch=0)
d1 = {‘lon’: [35, 35.1], ‘lat’: [32.5, 32.6], ‘name’:[‘meA’, ‘meB’], ‘prec’:[100,300], ‘temp’:[10,30], ‘elevationValue’:[100,300]}
df1 = pd.DataFrame(data=d1)
df_map1 = pd.DataFrame(df1)
tooltip = {
“html”: "Name: {name}
"
“Rain: {prec} mm
”,
“style”: {
“backgroundColor”: “steelblue”,
“color”: “black”}
}
slayer = pdk.Layer(
type=‘ScatterplotLayer’,
data=df_map1,
get_position=[“lon”, “lat”],
get_color=[“255-temp3", "31+temp2”, “31+temp*3”],
get_line_color=[0, 0, 0],
get_radius=1750,
pickable=True,
onClick=True,
filled=True,
line_width_min_pixels=10,
opacity=2,
)
layert1 = pdk.Layer(
“TextLayer”,
df_map1,
pickable=False,
get_position=[“lon”, “lat”],
get_text=“name”,
get_size=3000,
sizeUnits=‘meters’,
get_color=[0, 0, 0],
get_angle=0,
# Note that string constants in pydeck are explicitly passed as strings
# This distinguishes them from columns in a data set
getTextAnchor= ‘“middle”’,
get_alignment_baseline=’“center”’
)
pp = pdk.Deck(
initial_view_state=view_state,
map_provider=‘mapbox’,
map_style=pdk.map_styles.SATELLITE,
layers=[slayer,
hlayer,
layert1],
tooltip=tooltip
)
deckchart = st.pydeck_chart(pupu)
It’s pretty simple: a have some lon/lat points, and i want to display it as circles on a map. for each circle i want also to display the temperature as text on the circle.
When i use a textLayer the text is above the circle when the maps’ Pitch is 0 degrees, but with 45deg pitch the text is partially hidden by the circle. So can i define which layer will be above the other and which will hide the other? Or even easier: Does the scatterplotLayer have a possibility to add text as part of it?
Meanwhile i had more questions:
Is there a possibility to add two textLayers on the same map? my map is freezing when i try to do it.
Thanks!
Yair