11# -*- coding: utf-8 -*-
22"""
3- TimestampedGeoJson plugin
4- --------------
3+ TimestampedWmsTileLayers plugin
4+ -------------------------------
55
6- Add a timestamped geojson feature collection on a folium map.
6+ Add timestamped WMS Tile Layers on a folium map.
77This is based on Leaflet.TimeDimension.
88
99https://github.com/socib/Leaflet.TimeDimension
1010
11- A geo-json is timestamped if:
12- * it contains only features of types LineString, MultiPoint,
13- MultiLineString and MultiPolygon.
14- * each feature has a "times" property with the same length as the
15- coordinates array.
16- * each element of each "times" property is a timestamp in ms since epoch,
17- or in ISO string. Eventually, you may have Point features with a
18- "times" property being an array of length 1.
11+ A WMS layer is timestamped if it contains timepositions information.
1912
2013"""
2114
@@ -44,26 +37,26 @@ def __init__(self, data, transition_time=200, loop=False, auto_play=False,
4437 examples :
4538 # Create WmsTileLayer
4639 w1 = features.WmsTileLayer(
47- " http://this.wms.server/ncWMS/wms" ,
48- name=" Test WMS Data" ,
49- styles="" ,
50- format=" image/png" ,
40+ ' http://this.wms.server/ncWMS/wms' ,
41+ name=' Test WMS Data' ,
42+ styles='' ,
43+ format=' image/png' ,
5144 transparent=True,
52- layers=" test_data" ,
53- COLORSCALERANGE=" 0,10" ,
45+ layers=' test_data' ,
46+ COLORSCALERANGE=' 0,10' ,
5447 )
5548 # Add to map
5649 w1.add_to(m)
5750
5851 # Create WmsTileLayer
5952 w2 = features.WmsTileLayer(
60- " http://this.wms.server/ncWMS/wms" ,
61- name=" Test WMS Data" ,
62- styles="" ,
63- format=" image/png" ,
53+ ' http://this.wms.server/ncWMS/wms' ,
54+ name=' Test WMS Data' ,
55+ styles='' ,
56+ format=' image/png' ,
6457 transparent=True,
65- layers=" test_data_2" ,
66- COLORSCALERANGE=" 0,5" ,
58+ layers=' test_data_2' ,
59+ COLORSCALERANGE=' 0,5' ,
6760 )
6861 # Add to map
6962 w2.add_to(m)
@@ -80,19 +73,19 @@ def __init__(self, data, transition_time=200, loop=False, auto_play=False,
8073 auto_play : bool, default False
8174 Whether the animation shall start automatically at startup, default
8275 is to reduce load on WMS services.
83- period : str, default " P1D"
76+ period : str, default ' P1D'
8477 Used to construct the array of available times starting
8578 from the first available time. Format: ISO8601 Duration
86- ex: " P1M" -> 1/month
87- " P1D" -> 1/day
88- " PT1H" -> 1/hour
89- " PT1M" -> 1/minute
79+ ex: ' P1M' -> 1/month
80+ ' P1D' -> 1/day
81+ ' PT1H' -> 1/hour
82+ ' PT1M' -> 1/minute
9083 Note: this seems to be overridden by the WMS Tile Layer
9184 GetCapabilities.
9285 """
9386 super (TimestampedWmsTileLayers , self ).__init__ (overlay = True ,
9487 control = False ,
95- name = " timestampedwms" )
88+ name = ' timestampedwms' )
9689 self ._name = 'TimestampedWmsTileLayers'
9790
9891 self .transition_time = int (transition_time )
@@ -135,29 +128,29 @@ def render(self, **kwargs):
135128 super (TimestampedWmsTileLayers , self ).render ()
136129
137130 figure = self .get_root ()
138- assert isinstance (figure , Figure ), (" You cannot render this Element "
139- " if it's not in a Figure." )
131+ assert isinstance (figure , Figure ), (' You cannot render this Element '
132+ ' if it is not in a Figure.' )
140133
141134 figure .header .add_child (
142- JavascriptLink (" https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js" ), # noqa
135+ JavascriptLink (' https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js' ), # noqa
143136 name = 'jquery2.0.0' )
144137
145138 figure .header .add_child (
146- JavascriptLink (" https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js" ), # noqa
139+ JavascriptLink (' https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js' ), # noqa
147140 name = 'jqueryui1.10.2' )
148141
149142 figure .header .add_child (
150- JavascriptLink (" https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js" ), # noqa
143+ JavascriptLink (' https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js' ), # noqa
151144 name = 'iso8601' )
152145
153146 figure .header .add_child (
154- JavascriptLink (" https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js" ), # noqa
147+ JavascriptLink (' https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js' ), # noqa
155148 name = 'leaflet.timedimension' )
156149
157150 figure .header .add_child (
158- CssLink (" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css" ), # noqa
151+ CssLink (' https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css' ), # noqa
159152 name = 'highlight.js_css' )
160153
161154 figure .header .add_child (
162- CssLink (" http://apps.socib.es/Leaflet.TimeDimension/dist/leaflet.timedimension.control.min.css" ), # noqa
155+ CssLink (' http://apps.socib.es/Leaflet.TimeDimension/dist/leaflet.timedimension.control.min.css' ), # noqa
163156 name = 'leaflet.timedimension_css' )
0 commit comments