```{code-cell} ipython3 --- nbsphinx: hidden --- import folium import folium.plugins ``` ## TimestampedGeoJson Show changing geospatial data over time. ### Relation to Timeline This is a plugin with a similar purpose to `Timeline`. They both show geospatial information that changes over time. The main difference between the two is the input format. In the `TimestampedGeojson` each `Feature` has an array of start times. Each start time in the array corresponds to a part of the `Geometry` of that `Feature`. In the `Timeline` plugin each `Feature` has its own `start` and `end` time among its properties. Also `TimestampedGeoJson` has a global `duration` property that is valid for all `Features`. In the `Timeline` plugin each `Feature` has its own `end` time property. Depending on your input geojson, one plugin may be more convenient than the other. ### Relation to Realtime This plugin can only show data from the past. If you want live updates, you need the `Realtime` plugin. ### Example 1 ```{code-cell} ipython3 m = folium.Map(location=[35.68159659061569, 139.76451516151428], zoom_start=16) # Lon, Lat order. lines = [ { "coordinates": [ [139.76451516151428, 35.68159659061569], [139.75964426994324, 35.682590062684206], ], "dates": ["2017-06-02T00:00:00", "2017-06-02T00:10:00"], "color": "red", }, { "coordinates": [ [139.75964426994324, 35.682590062684206], [139.7575843334198, 35.679505030038506], ], "dates": ["2017-06-02T00:10:00", "2017-06-02T00:20:00"], "color": "blue", }, { "coordinates": [ [139.7575843334198, 35.679505030038506], [139.76337790489197, 35.678040905014065], ], "dates": ["2017-06-02T00:20:00", "2017-06-02T00:30:00"], "color": "green", "weight": 15, }, { "coordinates": [ [139.76337790489197, 35.678040905014065], [139.76451516151428, 35.68159659061569], ], "dates": ["2017-06-02T00:30:00", "2017-06-02T00:40:00"], "color": "#FFFFFF", }, ] features = [ { "type": "Feature", "geometry": { "type": "LineString", "coordinates": line["coordinates"], }, "properties": { "times": line["dates"], "style": { "color": line["color"], "weight": line["weight"] if "weight" in line else 5, }, }, } for line in lines ] folium.plugins.TimestampedGeoJson( { "type": "FeatureCollection", "features": features, }, period="PT1M", add_last_point=True, ).add_to(m) m ``` ### Example 2 ```{code-cell} ipython3 table = """\
Firstname | Lastname | Age |
---|---|---|
Jill | Smith | 50 |
Eve | Jackson | 94 |