Phil
April 6, 2020, 8:41am
1
Hi,
Using pydeck_chart with HexagonLayer and ScatterplotLayer with success
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 !
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
Phil
April 7, 2020, 12:38pm
3
Hi!
Nice to hear that this will work soon !
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],
))
Phil
April 7, 2020, 12:39pm
4
Should get something like: