Skip to main content

streamlit-deckgl

Streamlit component for deck.gl visualisation with bi-directional transport for onClick events.

Installation instructions

pip install streamlit-deckgl

Usage

There is one component function st_deckgl with function signature:

component_value=st_deckgl(deck, height=500, configuration=None, key="deck_gl", events=None, description=None)

Parameters

deck : pydeck.Deck instance
    The pydeck map to render.
key : str, default "deck_gl"
    The key for the component. This must be unique for each map in the app.
height : int, default 500
    The height of the map in pixels.
events : list, default None
    A dict of events to listen for. Can be one or more of:
    - 'click'
    - 'hover'
    - 'drag'
description : dict, default None
    A dictionary with additional description components to overlay on the map
    The keys are the position which can be one of 'top-right','top-left','bottom-right','bottom-left'
    The values are the html elements to place in each position
    Example {'top-right':<div>This is a nice map</div>}
configuration : dict, default None
    A dictionary of configuration options for the map.

Returns

component_value : dict
    A dictionary containing the info dictionary of the event.

Example

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

from streamlit_deckgl import st_deckgl


st.write("## Example")

chart_data = pd.DataFrame(
    np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4], columns=["lat", "lon"]
)

r = pdk.Deck(
    initial_view_state=pdk.ViewState(
        latitude=37.76, longitude=-122.4, zoom=11, pitch=50, height=600
    ),
    layers=[
        pdk.Layer(
            "HexagonLayer",
            data=chart_data,
            get_position="[lon, lat]",
            radius=200,
            elevation_scale=4,
            elevation_range=[0, 1000],
            pickable=True,
            extruded=True,
        ),
        pdk.Layer(
            "ScatterplotLayer",
            data=chart_data,
            get_position="[lon, lat]",
            get_color="[200, 30, 0, 160]",
            get_radius=200,
        ),
    ],
    tooltip={
        "html": "<b>Temperature:</b> {value} °C",
        "style": {"backgroundColor": "steelblue", "color": "white"},
    },
)

value = st_deckgl(r,)

st.write(value)

Metadata

Release files for streamlit-deckgl 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-deckgl 0.5.1
File Size Uploaded
streamlit-deckgl-0.5.1.tar.gz 62.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-deckgl 0.5.1
File Interpreter ABI Platform
streamlit_deckgl-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 124.5 kB

Release files / streamlit-deckgl-0.5.1.tar.gz

Download URL streamlit-deckgl-0.5.1.tar.gz
Size 62.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a8e9e42be11a3c087a51b76044b2c4bd9081f0c80918ab46d45f806565555c54
BLAKE2b-256 checksum
How to use checksums
7686b82985c67bfe835f1e1142aee44e21aa76adaccbf1193aace5d9c498978a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.12

Release files / streamlit_deckgl-0.5.1-py3-none-any.whl

Download URL streamlit_deckgl-0.5.1-py3-none-any.whl
Size 62.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a7241195d6ba2a75e039ad8f61e8a2fe5f9db1a792d1ca6e7267ded9b5fee1c
BLAKE2b-256 checksum
How to use checksums
7a9cc77e7cc98c79d36689959f59f8d144fdd78d2e02974ae0521685e8568d73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page