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