Pydeck layer not rendering

977 Views Asked by At

I'm trying to visualize some data using pydeck. The layers were working as intended until I began tinkering with other sections which broke my layer render somehow. After two days of tinkering I'm at a loss why the layer won't display.

I'm building the layer using the function:

def col_layer(self, w_df, elevation_range = 1000, elevation_var):
        elevation_data = w_df[elevation_var]
        elevation_data = [z for z in elevation_data.tolist()]
        el_max = max(elevation_data)
        elev_scale = elevation_range / el_max 
        color = randint(0,255)
        color2 = randint(0,255)
        
        column_layer = pdk.Layer(
            "ColumnLayer",
            data=w_df,
            get_position='[lat,lng]',
            get_elevation=elevation_var,
            elevation_scale=elev_scale,
            radius = 1,
            elevation_range=[0,elevation_range],
            extruded=True,
            get_fill_color=[color, color2, color2, color],
            pickable=True,
            auto_highlight=True,
            coverage=1,
        )
        return column_layer

where w_df contains 3 columns, ['lat','lng','elevation_variable'] and then building the deck object using:

layer = viz.col_layer(plot_df, elevation_range=1000,elevation_var=elevation_var)
view = viz.view(plot_df)
tooltip = viz.tooltip(variable=elevation_var)
    a = viz.deck(
        layers = layer,
        initial_view_state=view,
        api_keys=api_keys,
        tooltip=tooltip,
        map_provider="mapbox",
        map_style=pdk.map_styles.SATELLITE
    )

This returns a satellite map focused on the correct area but with no layer. Can someone point me in the right direction?

1

There are 1 best solutions below

0
On

Hard to say without looking at the underlying data but pydeck expects input data in (X, Y) format and your position is specified in lat-lon, which is (Y, X). You might also want to check your browser's developer console for more detailed errors.