TimestampedGeoJson duration parameter causes polygons to disappear
See original GitHub issueHi all - I’m having trouble modifying a code snippet from the second TimestampedGeoJson example in the Plugins example notebook.
import folium
from folium.plugins import TimestampedGeoJson
m = folium.Map(location=[52.467697, -2.548828], zoom_start=6)
polygon = {
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
'coordinates': [((
(-2.548828, 51.467697),
(-0.087891, 51.536086),
(-1.516113, 53.800651),
(-6.240234, 53.383328),
),)],
},
'properties': {
'style': {
'color': 'blue',
},
'times': ['2015-07-22T00:00:00', '2015-08-22T00:00:00', '2015-09-22T00:00:00']
}
}
TimestampedGeoJson(
{'type': 'FeatureCollection', 'features': [polygon]},
period='P1M',
duration='P1M',
auto_play=False,
loop=False,
loop_button=True,
date_options='YYYY/MM/DD',
).add_to(m)
m
The duration
parameter is described as the “period of time which the features will be shown on the map after their time has passed. If None, all previous times will be shown.”
I expect this geometry to be shown on the map for all three time periods, but instead I see it disappear after the first time period.
I’m using folium version 0.6.0 without an ad-blocker. This happens in both Jupyter and html export. The duration parameter was introduced in #894.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
TimestampedGeoJson duration parameter causes polygons to ...
The duration parameter is described as the "period of time which the features will be shown on the map after their time has...
Read more >python-visualization/folium - Gitter
Another question: Is there an easy way to overlay labels for each polygon in a folium.feature.GeoJson , say by specifying the column on...
Read more >2021年08月_weixin_39786534的博客_CSDN博客
TimestampedGeoJson duration parameter causes polygons to disappear. 2021-01-12 ... Build failed on ARMv7: c++: error: missing argument to '-march='.
Read more >TimestampedGeoJson duration parameter causes po...anycodings
TimestampedGeoJson duration parameter causes polygons to disappear I'm having trouble modifying a code snippet anycod ...
Read more >Python Data. Leaflet.js Maps. - PythonRepo
Maps with complex polygon layers not rendering in Jupyter Lab/Notebook ... This is a major time waster and makes a bad impression on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
According to the corresponding document of leaflet.js, ( https://github.com/socib/Leaflet.TimeDimension/tree/520cb80f645112e242c5160cb44b7d5f2cae380d#ltimedimensionlayergeojson )
coordTimes, times or linestringTimestamps: array of times that can be associated with a geometry (datestrings or ms). In the case of a LineString, it must have as many items as coordinates in the LineString.
That means if one want to show the polygon at those 6 timestamps, the length of geometry coordinate list should be 6, in order to specify the polygon to be shown at corresponding timestamp.
In you case, you want to show the same polygon (polygon1) at those 6 timestamps. You can add
* 6
after the coordinate list to make copies.So the code that meet your expectation would be:
Hope that helps.
how do you read a file of multipolygons from a geodataframe?