Reputation: 23
I have a DataSet like following and I want to represent in a pydeck layer map the column n_cases:
I am doing in this way, but i never get elevation in the hexagons, have tried with lot of elevation ranges and elevation scales:
r = pdk.Deck(map_style=None,
initial_view_state=pdk.ViewState(
latitude=provincias_map['latitude'].mean(),
longitude=provincias_map['longitude'].mean(),
zoom=5,
pitch=45),
layers=[
pdk.Layer(
'HexagonLayer',
data=provincias_map,
get_position='[longitude, latitude]',
get_elevation = 'n_cases',
radius=18000,
elevation_scale=20,
elevation_range=[0, 1780000],
pickable=True,
extruded=True,
coverage = 1,
)])
Upvotes: 1
Views: 642
Reputation: 38992
Set the get_elevation_weight option to 'n_cases' to have the computed elevation value as the correlated 'n_cases' value of the data point.
max_range = int(provincias_map['n_cases'].max())
r = pdk.Deck(map_style=None,
initial_view_state=pdk.ViewState(
latitude=provincias_map['latitude'].mean(),
longitude=provincias_map['longitude'].mean(),
zoom=5,
pitch=45),
layers=[
pdk.Layer(
'HexagonLayer',
data=provincias_map,
get_position='[longitude, latitude]',
get_elevation_weight = 'n_cases',
radius=18000,
elevation_scale=1,
elevation_range=[0, max_range],
pickable=True,
extruded=True,
coverage = 1,
)])
Upvotes: 1