Not getting Elevation with Pydeck

394 Views Asked by At

I have a DataSet like following and I want to represent in a pydeck layer map the column n_cases:

Table

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,
        )])



map

1

There are 1 best solutions below

0
On

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,
        )])