@@ -90,13 +90,14 @@ def __init__(self, location=None, width='100%', height='100%',
9090
9191 Examples
9292 --------
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/'
100101 'mapbox.control-room/{z}/{x}/{y}.png'),
101102 attr='Mapbox attribution')
102103
@@ -209,24 +210,46 @@ def __init__(self, location=None, width='100%', height='100%',
209210 self .template_vars .setdefault ('image_layers' , [])
210211
211212 @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.
214216
215217 Parameters
216218 ----------
217219 tile_name: string
218220 name of the tile layer
219221 tile_url: string
220222 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+
223227 """
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+
224238 if tile_name not in self .added_layers :
225239 tile_name = tile_name .replace (" " , "_" )
226240 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+ })
230253
231254 self .template_vars .setdefault ('tile_layers' , []).append ((tile ))
232255
@@ -305,8 +328,8 @@ def simple_marker(self, location=None, popup=None,
305328
306329 Example
307330 -------
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'))
310333
311334 """
312335 count = self .mark_cnt ['simple' ]
@@ -364,8 +387,8 @@ def line(self, locations,
364387
365388 Example
366389 -------
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)],
369392 line_color='red', line_opacity=1.0)
370393
371394 """
@@ -409,7 +432,6 @@ def multiline(self, locations, line_color=None, line_opacity=None,
409432
410433 Example
411434 -------
412- # FIXME: Add another example.
413435 >>> m.multiline(locations=[[(45.5236, -122.675), (45.5236, -122.675)],
414436 [(45.5237, -122.675), (45.5237, -122.675)],
415437 [(45.5238, -122.675), (45.5238, -122.675)]])
@@ -467,9 +489,9 @@ def circle_marker(self, location=None, radius=500, popup=None,
467489
468490 Example
469491 -------
470- >>>map.circle_marker(location=[45.5, -122.3],
492+ >>> map.circle_marker(location=[45.5, -122.3],
471493 radius=1000, popup='Portland, OR')
472- >>>map.circle_marker(location=[45.5, -122.3],
494+ >>> map.circle_marker(location=[45.5, -122.3],
473495 radius=1000, popup=(bar_chart, 'bar_data.json'))
474496
475497 """
@@ -584,7 +606,7 @@ def click_for_marker(self, popup=None):
584606
585607 Example
586608 -------
587- >>>map.click_for_marker(popup='Your Custom Text')
609+ >>> map.click_for_marker(popup='Your Custom Text')
588610
589611 """
590612 latlng = '"Latitude: " + lat + "<br>Longitude: " + lng '
0 commit comments