python-visualization / python-visualization/folium

Time Slider with Varying MultiPolygon Size by Time Stamp

Abierto
#1,750 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
7.4k
Forks
2.3k
Merge medio
17 h 22 min
PR fusionados (30 d)
11

Descripción

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:
image
There shouldn't be any overlapping lines on the map for the initial time stamp.

The final slide looks good:
image

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

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).

data.zip
script.txt

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con script.txt y reproduce el problema en el entorno de Jupyter Notebook usando data.zip y la configuración de TimeSliderChoropleth mostrada en el issue. Inspecciona cómo se representan las formas MultiPolygon variables a lo largo de las marcas de tiempo y cómo el slider transiciona entre ellas. Se considera terminado cuando la marca de tiempo inicial muestra únicamente sus propias geometrías y al desplazarse por el slider no quedan superpuestos datos de marcas de tiempo anteriores o de la marca de tiempo final.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
jupyter-notebook, pandas, python
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.