python-visualization / python-visualization/folium
Time Slider with Varying MultiPolygon Size by Time Stamp
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 7.4k
- Forks
- 2.3k
- Merge moyen
- 17 h 22 min
- PR mergées (30 j)
- 11
Description
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).
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par script.txt et reproduisez le problème dans l’environnement Jupyter Notebook en utilisant data.zip et la configuration TimeSliderChoropleth présentée dans l’issue. Examinez comment des formes MultiPolygon variables sont représentées au fil des horodatages et comment le slider effectue la transition entre elles. Le travail est terminé si l’horodatage initial n’affiche que ses propres géométries et que le déplacement du slider ne laisse pas de données des horodatages précédents ou final superposées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- jupyter-notebook, pandas, python
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100