Pydeck_chart layers

Hi,

Using pydeck_chart with HexagonLayer and ScatterplotLayer with success :slightly_smiling_face:

I need to use the TripsLayer too but get only the background mapBox map.
It works FINE in JupyterNotebook, but not in Streamlit, no error message in Python, but this warning in the JS console
JSON converter: No registered class of type TripsLayer

Maybe, TripsLayer is not implemented? I thought that the API using pydeck would bring all Layers to Streamlit

Hello Phil, welcome to the forums :slight_smile: !

This may look like an issue on Streamlit’s side, a PR on integrating geo-layers has just been opened and almost merged.

If you have a reproducible example, we can test it once the PR is merged in the develop branch, I’ll ping you when that’s the case !

1 Like

Hi!

Nice to hear that this will work soon :slight_smile: !
As an example, something from pydeck is ok I guess:

import streamlit as st
import pandas as pd
import pydeck as pdk

trip = pd.read_json('https://raw.githubusercontent.com/uber-common/deck.gl-data/master/website/sf.trips.json')

trip["coordinates"] = trip["waypoints"].apply(lambda f: [item["coordinates"] for item in f])
trip["timestamps"] = trip["waypoints"].apply(
    lambda f: [item["timestamp"] - 1554772579000 for item in f]
)
trip.drop(["waypoints"], axis=1, inplace=True)
st.write(trip)

timestamp = st.sidebar.slider('Current timestamp', 100, 1000, 500, 100)

layer = pdk.Layer(
    'TripsLayer',
    trip,
    get_path="coordinates",
    get_timestamps="timestamps",
    get_color=[253, 128, 93],
    width_min_pixels=5,
    rounded=True,
    trail_length=600,
    current_time=timestamp,
)
view_state = pdk.ViewState(latitude=37.7749295,
                           longitude=-122.4194155,
                           zoom=11,
                           pitch=45)
deckchart = st.pydeck_chart(pdk.Deck(
    initial_view_state=view_state,
    layers=[layer],
))

Should get something like: