@@ -90,13 +90,14 @@ def __init__(self, location=None, width='100%', height='100%',
90
90
91
91
Examples
92
92
--------
93
- >>>map = folium.Map(location=[45.523, -122.675], width=750, height=500)
94
- >>>map = folium.Map(location=[45.523, -122.675],
95
- tiles='Mapbox Control Room')
96
- >>>map = folium.Map(location=(45.523, -122.675), max_zoom=20,
97
- tiles='Cloudmade', API_key='YourKey')
98
- >>>map = folium.Map(location=[45.523, -122.675], zoom_start=2,
99
- tiles=('http://{s}.tiles.mapbox.com/v3/'
93
+ >>> map = folium.Map(location=[45.523, -122.675], width=750,
94
+ ... height=500)
95
+ >>> map = folium.Map(location=[45.523, -122.675],
96
+ tiles='Mapbox Control Room')
97
+ >>> map = folium.Map(location=(45.523, -122.675), max_zoom=20,
98
+ tiles='Cloudmade', API_key='YourKey')
99
+ >>> map = folium.Map(location=[45.523, -122.675], zoom_start=2,
100
+ tiles=('http://{s}.tiles.mapbox.com/v3/'
100
101
'mapbox.control-room/{z}/{x}/{y}.png'),
101
102
attr='Mapbox attribution')
102
103
@@ -209,24 +210,46 @@ def __init__(self, location=None, width='100%', height='100%',
209
210
self .template_vars .setdefault ('image_layers' , [])
210
211
211
212
@iter_obj ('simple' )
212
- def add_tile_layer (self , tile_name = None , tile_url = None , active = False ):
213
- """Adds a simple tile layer.
213
+ def add_tile_layer (self , tile_name = None , tile_url = None , ** kw ):
214
+ """
215
+ Adds a simple tile layer.
214
216
215
217
Parameters
216
218
----------
217
219
tile_name: string
218
220
name of the tile layer
219
221
tile_url: string
220
222
url location of the tile layer
221
- active: boolean
222
- should the layer be active when added
223
+
224
+ For the available options see:
225
+ http://leafletjs.com/reference.html#tilelayer
226
+
223
227
"""
228
+ # Same defaults.
229
+ tms = kw .pop ('tms' , 'false' )
230
+ minZoom = kw .pop ('minZoom' , 0 )
231
+ opacity = kw .pop ('opacity' , 1 )
232
+ maxZoom = kw .pop ('maxZoom' , 18 )
233
+ noWrap = kw .pop ('noWrap' , 'false' )
234
+ zoomOffset = kw .pop ('zoomOffset' , 0 )
235
+ zoomReverse = kw .pop ('zoomReverse' , 'false' )
236
+ continuousWorld = kw .pop ('continuousWorld' , 'false' )
237
+
224
238
if tile_name not in self .added_layers :
225
239
tile_name = tile_name .replace (" " , "_" )
226
240
tile_temp = self .env .get_template ('tile_layer.js' )
227
-
228
- tile = tile_temp .render ({'tile_name' : tile_name ,
229
- 'tile_url' : tile_url })
241
+ tile = tile_temp .render ({
242
+ 'tile_name' : tile_name ,
243
+ 'tile_url' : tile_url ,
244
+ 'minZoom' : minZoom ,
245
+ 'maxZoom' : maxZoom ,
246
+ 'tms' : str (tms ).lower (),
247
+ 'continuousWorld' : str (continuousWorld ).lower (),
248
+ 'noWrap' : str (noWrap ).lower (),
249
+ 'zoomOffset' : zoomOffset ,
250
+ 'zoomReverse' : str (zoomReverse ).lower (),
251
+ 'opacity' : opacity ,
252
+ })
230
253
231
254
self .template_vars .setdefault ('tile_layers' , []).append ((tile ))
232
255
@@ -305,8 +328,8 @@ def simple_marker(self, location=None, popup=None,
305
328
306
329
Example
307
330
-------
308
- >>>map.simple_marker(location=[45.5, -122.3], popup='Portland, OR')
309
- >>>map.simple_marker(location=[45.5, -122.3], popup=(vis, 'vis.json'))
331
+ >>> map.simple_marker(location=[45.5, -122.3], popup='Portland, OR')
332
+ >>> map.simple_marker(location=[45.5, -122.3], popup=(vis, 'vis.json'))
310
333
311
334
"""
312
335
count = self .mark_cnt ['simple' ]
@@ -364,8 +387,8 @@ def line(self, locations,
364
387
365
388
Example
366
389
-------
367
- >>>map.line(locations=[(45.5, -122.3), (42.3, -71.0)])
368
- >>>map.line(locations=[(45.5, -122.3), (42.3, -71.0)],
390
+ >>> map.line(locations=[(45.5, -122.3), (42.3, -71.0)])
391
+ >>> map.line(locations=[(45.5, -122.3), (42.3, -71.0)],
369
392
line_color='red', line_opacity=1.0)
370
393
371
394
"""
@@ -409,7 +432,6 @@ def multiline(self, locations, line_color=None, line_opacity=None,
409
432
410
433
Example
411
434
-------
412
- # FIXME: Add another example.
413
435
>>> m.multiline(locations=[[(45.5236, -122.675), (45.5236, -122.675)],
414
436
[(45.5237, -122.675), (45.5237, -122.675)],
415
437
[(45.5238, -122.675), (45.5238, -122.675)]])
@@ -467,9 +489,9 @@ def circle_marker(self, location=None, radius=500, popup=None,
467
489
468
490
Example
469
491
-------
470
- >>>map.circle_marker(location=[45.5, -122.3],
492
+ >>> map.circle_marker(location=[45.5, -122.3],
471
493
radius=1000, popup='Portland, OR')
472
- >>>map.circle_marker(location=[45.5, -122.3],
494
+ >>> map.circle_marker(location=[45.5, -122.3],
473
495
radius=1000, popup=(bar_chart, 'bar_data.json'))
474
496
475
497
"""
@@ -584,7 +606,7 @@ def click_for_marker(self, popup=None):
584
606
585
607
Example
586
608
-------
587
- >>>map.click_for_marker(popup='Your Custom Text')
609
+ >>> map.click_for_marker(popup='Your Custom Text')
588
610
589
611
"""
590
612
latlng = '"Latitude: " + lat + "<br>Longitude: " + lng '
0 commit comments