python-visualization / python-visualization/folium
Time Slider with Varying MultiPolygon Size by Time Stamp
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 7.4k
- Fork
- 2.3k
- Merge medio
- 17h 22m
- PR unite (30g)
- 11
Descrizione
I'm trying to create a time slider which varies by day, however, 1) all MultiPolygons are initially displayed at once for the first time stamp and 2) if I use the slider from the start to the end of the slider, all previous time steps are overlaid by the final time step.
Note: All MultiPolygons are not consistent in terms of shape/size. I think this is related to the issue.
Here's a screen capture of the issue:

There shouldn't be any overlapping lines on the map for the initial time stamp.
The final slide looks good:

However, once I scroll through all slides once, all data is overlaid by the final time stamp:

Here's the important part of the script:
#---create a style dictionary
styledata = {}
for i in range(allgpd.shape[0]):
subset = allgpd.iloc[i]
idxname = pd.Index([subset.times], dtype="U10")
df = pd.DataFrame({"color": allgpd['color'][i],"opacity": 1,},index=idxname,)
styledata[i] = df
#---reformat
styledict = {str(idx): data.to_dict(orient="index") for idx, data in styledata.items()}
#---create the folium slider
m = folium.Map(location=[qlat, qlon], zoom_start=6)
g = TimeSliderChoropleth(
allgpd.to_json(),
styledict=styledict,
control=True,
overlay=True, show=False).add_to(m)
m
I also attached my script in its entirety to this thread, as well (script.txt).
Environment details (Jupyter Notebook):
System: sys.version_info(major=3, minor=9, micro=12, releaselevel='final', serial=0)
Folium: 0.14.0
Branca: 0.6.0
I attached the data to this thread (data.zip).
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con script.txt e riproduci il problema nell'ambiente Jupyter Notebook usando data.zip e la configurazione TimeSliderChoropleth mostrata nell'issue. Esamina come vengono rappresentate le forme MultiPolygon variabili tra i diversi timestamp e come lo slider effettua la transizione tra di esse. Il lavoro è completato quando il timestamp iniziale mostra solo le proprie geometrie e lo spostamento dello slider non lascia sovrapposti dati dei timestamp precedenti o del timestamp finale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- jupyter-notebook, pandas, python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100