How to use the pydeck.Deck function in pydeck

To help you get started, we’ve selected a few pydeck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rapidsai / cuxfilter / python / cuxfilter / charts / deckgl / bindings / panel_deck.py View on Github external
def __init__(self, **params):
        """
        initialize pydeck object, and set a listener on self.data
        """
        super(PanelDeck, self).__init__(**params)
        self._view_state = pdk.ViewState(
            **self.spec["initialViewState"], bearing=0.45,
        )
        self._layers = pdk.Layer(
            "PolygonLayer", data=self.data, **self.spec["layers"][0]
        )
        self._tooltip = {"html": self.get_tooltip_html()}

        self._deck = pdk.Deck(
            mapbox_key=self.spec["mapboxApiAccessToken"],
            layers=[self._layers],
            initial_view_state=self._view_state,
            tooltip=self._tooltip,
        )
        self.pane = pn.pane.DeckGL(
            self._deck,
            sizing_mode=self.sizing_mode,
            height=self.height,
            width=self.width,
            css_classes=["deck-chart"],
        )
        self.param.watch(self._update, ["data"])
github streamlit / demo-uber-nyc-pickups / app.py View on Github external
lowercase = lambda x: str(x).lower()
    data.rename(lowercase, axis="columns", inplace=True)
    data[DATE_TIME] = pd.to_datetime(data[DATE_TIME])
    return data


data = load_data(100000)

hour = st.slider("Hour to look at", 0, 23)

data = data[data[DATE_TIME].dt.hour == hour]

st.subheader("Geo data between %i:00 and %i:00" % (hour, (hour + 1) % 24))
midpoint = (np.average(data["lat"]), np.average(data["lon"]))

st.write(pdk.Deck(
    map_style="mapbox://styles/mapbox/light-v9",
    initial_view_state={
        "latitude": midpoint[0],
        "longitude": midpoint[1],
        "zoom": 11,
        "pitch": 50,
    },
    layers=[
        pdk.Layer(
            "HexagonLayer",
            data=data,
            get_position=["lon", "lat"],
            radius=100,
            elevation_scale=4,
            elevation_range=[0, 1000],
            pickable=True,

pydeck

Widget for deck.gl maps

MIT
Latest version published 6 months ago

Package Health Score

95 / 100
Full package analysis