Ability to update Deck.GL viewport dynamically
See original GitHub issueSteps to repro:
- Run this file:
import streamlit as st
import numpy as np
import pandas as pd
df = pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
columns=['lat', 'lon'])
x = st.deck_gl_chart(
viewport={
'latitude': 0,
'longitude': 0,
'zoom': 11,
'pitch': 50,
},
layers=[{
'type': 'ScatterplotLayer',
'data': df,
}])
x.deck_gl_chart(
viewport={
'latitude': 37.76, # ← this changed
'longitude': -122.4, # ← this changed
'zoom': 11,
'pitch': 50,
},
layers=[{
'type': 'ScatterplotLayer',
'data': df,
}])
Actual: the chart is centered a (0,0), in the Atlantic ocean Expected: the chart is centered at (37, -122)
Complication: need to figure out what the desired behavior is for when the user recenters the map via the UI, and then a script rerun is triggered.
My gut feeling is that if the rerun has the same viewport
as from when before the user interacted (or, may if the proto being sent is the same), the user’s interaction should take precedence. Otherwise, the new viewport
setting should take precedence. This is similar to how we handle widgets.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Views and Projections - deck.gl
Whenever viewState updates, the view creates a new viewport under the hood. Typically, the deck.gl user does not need to work with viewports...
Read more >Upgrade Guide - deck.gl
All dynamic attributes now must be explicitly specified. This change makes sure that using default values results in best performance. Views and Controllers....
Read more >What's New - deck.gl
Tiled layers now use a request scheduler to prioritize loading the most recently visible tiles during viewport navigation. See the new maxRequests prop....
Read more >Layer Class - deck.gl
deck.gl automatically applies gamma to the opacity in an attempt to make opacity changes appear linear (i.e. the perceived opacity is visually proportional...
Read more >Adding Interactivity - deck.gl
Controlling the Camera. Out of the box, deck.gl offers viewport controllers that map keyboard, mouse or touch input to camera state change. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any workaround (even ugly and hacky - I don’t really care right now) to make the map fly to a specific location, until this is fixed? I have a select option and every time I select a new element (that is associated to a pair of coordinates) I would like the map to fly to that location.
I was able to do update the map with this workaround: