python-visualization / python-visualization/folium

Animated markers missing when using pre1970 dates in TimestampedGeoJson

Open
#1,205 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
7.4k
Forks
2.3k
Avg merge
17h 22m
Merged PRs (30d)
11

Description

Animated markers missing when using pre1970 dates in TimestampedGeoJson. I understand this functionality from Leaflet.TimeDimension, but had thought this issue was fixed there (Merged pull request: https://github.com/socib/Leaflet.TimeDimension/pull/91).

Please add a code sample or a nbviewer link, copy-pastable if possible
import folium
from folium.plugins import TimestampedGeoJson

# Post-1970 timestamps: 1970-01-02, 1970-01-03, 1970-01-04
milliseconds_per_day = 1000 * 60 * 60 * 24
post_1970_timestamps=[1*milliseconds_per_day, 2*milliseconds_per_day, 3*milliseconds_per_day]
# Pre-1970 timestamps: 1969-12-29, 1969-12-30, 1969-12-31
pre_1970_timestamps=[0-time for time in post_1970_timestamps]
# Ensure pre_1970_timestamps are in ascending order:
pre_1970_timestamps.reverse()

m = folium.Map(location=[0,0],zoom_start=2)
ts=TimestampedGeoJson({
     'type': 'FeatureCollection',
     'features': [
       {
         'type': 'Feature',
         'geometry': {
           'type': 'LineString',
           'coordinates': [[-70,-25],[-70,35],[70,35]],
           },
         'properties': {
            # Dates shown in time slider controls, but no markers displayed on map
            # Contrast behaviour when times read from post_1970_timestamps list:
            # - animated markers shown on map as per example
            'times': pre_1970_timestamps
            #'times': post_1970_timestamps 
           }
         }
       ]
     })
ts.add_to(m)
m
Problem description

No markers shown on maps using TimestampedGeoJson with dates pre 1970 (as held in pre_1970_timestamps list)

Expected Output

Animated markers as per the TimestampedGeoJson with post_1970_timestamps

Output of folium.__version__

0.10.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the folium.plugins.TimestampedGeoJson entry point and compare the generated Leaflet.TimeDimension configuration for negative timestamps with the provided post-1970 sample. Reproduce the example, trace how the pre-1970 values reach the animation, and verify that animated markers appear for both timestamp ranges.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.