python-visualization / python-visualization/folium

Time Slider with Varying MultiPolygon Size by Time Stamp

Đang mở
#1,750 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
7.4k
Fork
2.3k
Merge trung bình
17 giờ 22 phút
Pull request đã merge (30 ngày)
11

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với script.txt và tái hiện vấn đề trong môi trường Jupyter Notebook bằng cách sử dụng data.zip và thiết lập TimeSliderChoropleth được hiển thị trong issue. Kiểm tra cách các hình dạng MultiPolygon khác nhau được biểu diễn qua các timestamp và cách slider chuyển tiếp giữa chúng. Được xem là hoàn tất khi timestamp ban đầu chỉ hiển thị các geometry của chính nó và việc di chuyển qua slider không để lại dữ liệu của các timestamp trước đó hoặc timestamp cuối cùng bị phủ chồng lên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
jupyter-notebook, pandas, python
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.