streamlit-deckgl


Namestreamlit-deckgl JSON
Version 0.5.1 PyPI version JSON
download
home_page
SummaryStreamlit component for deck.gl visualisation
upload_time2023-07-17 05:10:01
maintainer
docs_urlNone
authorOceanum
requires_python>=3.7
license
keywords streamlit pydeck deck.gl visualisation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # streamlit-deckgl

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

## Installation instructions

```sh
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

```python
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)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "streamlit-deckgl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "streamlit,pydeck,deck.gl,visualisation",
    "author": "Oceanum",
    "author_email": "developers@oceanum.science",
    "download_url": "https://files.pythonhosted.org/packages/76/86/b82985c67bfe835f1e1142aee44e21aa76adaccbf1193aace5d9c498978a/streamlit-deckgl-0.5.1.tar.gz",
    "platform": null,
    "description": "# streamlit-deckgl\n\nStreamlit component for deck.gl visualisation with bi-directional transport for onClick events.\n\n## Installation instructions\n\n```sh\npip install streamlit-deckgl\n```\n\n## Usage\n\nThere is one component function `st_deckgl` with function signature:\n\n```\ncomponent_value=st_deckgl(deck, height=500, configuration=None, key=\"deck_gl\", events=None, description=None)\n```\n\n### Parameters\n\n    deck : pydeck.Deck instance\n        The pydeck map to render.\n    key : str, default \"deck_gl\"\n        The key for the component. This must be unique for each map in the app.\n    height : int, default 500\n        The height of the map in pixels.\n    events : list, default None\n        A dict of events to listen for. Can be one or more of:\n        - 'click'\n        - 'hover'\n        - 'drag'\n    description : dict, default None\n        A dictionary with additional description components to overlay on the map\n        The keys are the position which can be one of 'top-right','top-left','bottom-right','bottom-left'\n        The values are the html elements to place in each position\n        Example {'top-right':<div>This is a nice map</div>}\n    configuration : dict, default None\n        A dictionary of configuration options for the map.\n\n### Returns\n\n    component_value : dict\n        A dictionary containing the info dictionary of the event.\n\n## Example\n\n```python\nimport streamlit as st\nimport pydeck as pdk\nimport pandas as pd\n\nfrom streamlit_deckgl import st_deckgl\n\n\nst.write(\"## Example\")\n\nchart_data = pd.DataFrame(\n    np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4], columns=[\"lat\", \"lon\"]\n)\n\nr = pdk.Deck(\n    initial_view_state=pdk.ViewState(\n        latitude=37.76, longitude=-122.4, zoom=11, pitch=50, height=600\n    ),\n    layers=[\n        pdk.Layer(\n            \"HexagonLayer\",\n            data=chart_data,\n            get_position=\"[lon, lat]\",\n            radius=200,\n            elevation_scale=4,\n            elevation_range=[0, 1000],\n            pickable=True,\n            extruded=True,\n        ),\n        pdk.Layer(\n            \"ScatterplotLayer\",\n            data=chart_data,\n            get_position=\"[lon, lat]\",\n            get_color=\"[200, 30, 0, 160]\",\n            get_radius=200,\n        ),\n    ],\n    tooltip={\n        \"html\": \"<b>Temperature:</b> {value} \u00b0C\",\n        \"style\": {\"backgroundColor\": \"steelblue\", \"color\": \"white\"},\n    },\n)\n\nvalue = st_deckgl(r,)\n\nst.write(value)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Streamlit component for deck.gl visualisation",
    "version": "0.5.1",
    "project_urls": null,
    "split_keywords": [
        "streamlit",
        "pydeck",
        "deck.gl",
        "visualisation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a9cc77e7cc98c79d36689959f59f8d144fdd78d2e02974ae0521685e8568d73",
                "md5": "472f53115931e53c949ec80cf8cd0cf5",
                "sha256": "4a7241195d6ba2a75e039ad8f61e8a2fe5f9db1a792d1ca6e7267ded9b5fee1c"
            },
            "downloads": -1,
            "filename": "streamlit_deckgl-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "472f53115931e53c949ec80cf8cd0cf5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 62276,
            "upload_time": "2023-07-17T05:09:59",
            "upload_time_iso_8601": "2023-07-17T05:09:59.006380Z",
            "url": "https://files.pythonhosted.org/packages/7a/9c/c77e7cc98c79d36689959f59f8d144fdd78d2e02974ae0521685e8568d73/streamlit_deckgl-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7686b82985c67bfe835f1e1142aee44e21aa76adaccbf1193aace5d9c498978a",
                "md5": "ff6697b46ce7b9a411dc97b54e9c62e5",
                "sha256": "a8e9e42be11a3c087a51b76044b2c4bd9081f0c80918ab46d45f806565555c54"
            },
            "downloads": -1,
            "filename": "streamlit-deckgl-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ff6697b46ce7b9a411dc97b54e9c62e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 62238,
            "upload_time": "2023-07-17T05:10:01",
            "upload_time_iso_8601": "2023-07-17T05:10:01.978374Z",
            "url": "https://files.pythonhosted.org/packages/76/86/b82985c67bfe835f1e1142aee44e21aa76adaccbf1193aace5d9c498978a/streamlit-deckgl-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-17 05:10:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "streamlit-deckgl"
}
        
Elapsed time: 0.08986s