2525from ..map import Layer
2626
2727
28- class TimestampedWmsTileLayer (Layer ):
28+ class TimestampedWmsTileLayers (Layer ):
2929 def __init__ (self , data , transition_time = 200 , loop = False , auto_play = False ,
3030 period = "P1D" ):
3131 """Creates a TimestampedWmsTileLayer subclass of Layer that takes a
@@ -55,8 +55,8 @@ def __init__(self, data, transition_time=200, loop=False, auto_play=False,
5555 w.add_to(m)
5656
5757 # Add WmsTileLayer to time control
58- time = plugins.TimestampedWmsTileLayer (w)
59- time.add_to(m )
58+ time = plugins.TimestampedWmsTileLayers (w)
59+ time.add_to([m,] )
6060
6161 transition_time : int, default 200.
6262 The duration in ms of a transition from between timestamps.
@@ -85,9 +85,8 @@ def __init__(self, data, transition_time=200, loop=False, auto_play=False,
8585 self .loop = bool (loop )
8686 self .auto_play = bool (auto_play )
8787 self .period = period
88- self .layer = data
88+ self .layers = data
8989 self ._template = Template ("""
90- print kwargs
9190 {% macro script(this, kwargs) %}
9291 {{this._parent.get_name()}}.timeDimension = L.timeDimension({period:"{{this.period}}"});
9392 {{this._parent.get_name()}}.timeDimensionControl = L.control.timeDimension({
@@ -99,12 +98,13 @@ def __init__(self, data, transition_time=200, loop=False, auto_play=False,
9998 });
10099 {{this._parent.get_name()}}.addControl({{this._parent.get_name()}}.timeDimensionControl);
101100
102-
103- var {{this.get_name()}} = L.timeDimension.layer.wms({{ this. layer.get_name() }},
101+ {% for layer in this.layers %}
102+ var {{this.get_name()}} = L.timeDimension.layer.wms({{ layer.get_name() }},
104103 {updateTimeDimension: true,
105- wmsVersion: '{{ this. layer.version }}',
104+ wmsVersion: '{{ layer.version }}',
106105 }
107106 ).addTo({{this._parent.get_name()}});
107+ {% endfor %}
108108 {% endmacro %}
109109 """ )
110110
0 commit comments