You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
importosimportdashimportdash_deckimportdash_html_componentsashtmlimportpydeckaspdkimportpandasaspdmapbox_api_token=os.getenv("MAPBOX_ACCESS_TOKEN")
app=dash.Dash(__name__)
# Map of San Francisco from 1906IMG_URL='"https://i.imgur.com/W95ked7.jpg"'# Specifies the corners of the image bounding boxBOUNDS= [
[-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)
The text was updated successfully, but these errors were encountered:
As to why you are not seeing a map. Add map_provider="mapbox" to pdk.Deck. Default map provider is carto and they do not seem to support map_style.SATELLITE. Look here for supported styles of carto.
For me the bitmap won't load due to a 403 Forbidden from imgur. Not sure why as loading the URL directly works fine. Possibly just an issue with using imgur.
Using the example from deck.gl documentation works fine for me. They use this URL: https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-districts.png
You should not need to double Quote the URL either.
Here is the version I got running:
importosimportdashimportdash_deckfromdashimporthtmlimportpydeckaspdkmapbox_api_token=os.getenv("MAPBOX_ACCESS_TOKEN")
app=dash.Dash(__name__)
# Map of San Francisco from 1906IMG_URL='https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-districts.png'# Specifies the corners of the image bounding boxBOUNDS= [-122.5190, 37.7045, -122.355, 37.829]
bitmap_layer=pdk.Layer(
"BitmapLayer", 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_provider="mapbox",
map_style=pdk.map_styles.SATELLITE,
)
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)
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!
The text was updated successfully, but these errors were encountered: