GithubHelp home page GithubHelp logo

plotly / dash-deck Goto Github PK

View Code? Open in Web Editor NEW
85.0 15.0 19.0 42.09 MB

Bringing deck.gl and pydeck into Dash

Home Page: https://dash-gallery.plotly.host/dash-deck-explorer/

License: MIT License

R 4.80% Python 38.05% HTML 0.51% JavaScript 56.64%
deck pydeck dash plotly

dash-deck's Issues

Cannot execute example code

Hello, i am trying to reproduce some example code but i cannot execute it.
Just keeps loading with a black screen. Here is the code example, maybe something change in the latest release?
Any idea? thank you!

import os

import dash
import dash_deck
import dash_html_components as html
import pydeck as pdk
import pandas as pd

mapbox_api_token = os.getenv("MAPBOX_ACCESS_TOKEN")

app = dash.Dash(__name__)


# Map of San Francisco from 1906
IMG_URL = '"https://i.imgur.com/W95ked7.jpg"'

# Specifies the corners of the image bounding box
BOUNDS = [
    [-122.52690000000051, 37.70313158980733],
    [-122.52690000000051, 37.816395657523195],
    [-122.34604834372873, 37.816134829424335],
    [-122.34656848822227, 37.70339041384273],
]

bitmap_layer = pdk.Layer(
    "BitmapLayer", data=None, image=IMG_URL, bounds=BOUNDS, opacity=0.7
)

view_state = pdk.ViewState(
    latitude=37.7576171, longitude=-122.5776844, zoom=10, bearing=-45, pitch=60,
)

r = pdk.Deck(
    bitmap_layer,
    initial_view_state=view_state,
    map_style=pdk.map_styles.SATELLITE,
    # mapbox_key=mapbox_api_token,
)


app.layout = html.Div(
    dash_deck.DeckGL(r.to_json(), id="deck-gl", mapboxKey=mapbox_api_token)
)


if __name__ == "__main__":
    app.run_server(debug=False)

Line-layer demo shows far less data than equivalent deck.gl demo yet both use same data source.

Hi,

The line-layer demo: https://dash-gallery.plotly.host/dash-deck-explorer/line-layer

Hows far less data than the equivalent deck.gl demo. https://deck.gl/examples/line-layer/

Yet both load and parse the same data source file:
https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/line/heathrow-flights.json

Any ideas on why this is the case? I cannot see any obvious cause in the code.

Thanks

Darren

Map not displaying when using columnLayer

In the dash-deck gallery, the example for Column layers is not displaying the map.
https://dash.gallery/dash-deck-explorer/column-layer
I have tried to reproduce the example locally and the same issue holds.
So my sample code is the code given in the gallery.
I have created an app with different data and the issue persists.
Any indication why this may be so?
Thanks.

Description

Steps/Code to Reproduce

Expected Results

Actual Results

Versions

Dash Deck Data Allocation: GeoJSON Handling

I am using Dash Deck to create interactive maps, but I have a question about the geojson data I upload. I want to know if the geojson data is stored on the Carto server or if it is only used for rendering the map. I don't want my data to be reused by anyone else without my permission.

Mirrored into conda-forge?

This is an awesome set of components. I'm glad this was made. Any chance it could mirrored into conda-forge? Thanks!

Is it possible to update map in a callback function based on the value of other components?

Description

I am trying to update the rendered map through a callback function like this:

layer = pdk.Layer(
    "TripsLayer",
    df,
    get_path="coordinates",
    get_timestamps="timestamps",
    get_color=[253, 128, 93],
    opacity=0.8,
    width_min_pixels=5,
    rounded=True,
    trail_length=600,
    current_time=500,
)

r = pdk.Deck(layers=[layer])
deckgl_map = dash_deck.DeckGL(r.to_json(), id="map-graph", mapboxKey=mapbox_access_token)

@app.callback(
    Output("map-graph", < component_property ??!! >),
    [
        Input("date-picker", "date"),
        Input("trip-slider", "value")
    ],
)
def update_graph(datePicked, sliderValue):
    # use slider-value to filter / modify and update the map 

In my layout, there is a date picker and a slider. I want to update the map based on the values on the slider and the date picker or any other input.
However I do not know the syntax to do so or whether it can be done at all.
Also, if it is possible, what would be the component_property for the deck component ?

Demo: ArcLayer

Resides in usage-arclayer.py. Currently, map style and tooltip are not working.

Render a Scenegraph Layer

Description

Hello,
I'm trying to render a Scenegraph layer with dash-deck but this does not seem possible.
I am getting an error Unexpected ":" at character 5

Steps/Code to Reproduce

Example:

import os
import dash
import dash_deck
import dash_html_components as html
import pydeck as pdk

mapbox_api_token = os.getenv("MAPBOX_ACCESS_TOKEN")

layer = pdk.Layer(
    "ScenegraphLayer",
    data=[{"coordinates": [-122.466233, 37.684638]}],
    draggable=True,
    scenegraph="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/BoxAnimated/glTF-Binary/BoxAnimated.glb",
    get_position="coordinates",
    get_orientation=[0, 20, 90],
    get_color=[100, 100, 100, 100],
    size_scale=1,
    _lighting="pbr",
)

view_state = pdk.ViewState(
    latitude=37.7749295, longitude=-122.4194155, zoom=11, bearing=0, pitch=45
)

# Render
r = pdk.Deck(layers=[layer], initial_view_state=view_state)


app = dash.Dash(__name__)

app.layout = html.Div(
    dash_deck.DeckGL(r.to_json(), id="deck-gl", mapboxKey=mapbox_api_token)
)


if __name__ == "__main__":
    app.run_server(debug=True)

Versions

Dash Core Components 2.0.0
Dash HTML Components 2.0.0
Dash Deck 0.0.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.