@@ -93,23 +93,15 @@ class Map(MacroElement):
93
93
tiles: str, default 'OpenStreetMap'
94
94
Map tileset to use. Can choose from a list of built-in tiles,
95
95
pass a custom URL or pass `None` to create a map without tiles.
96
- API_key: str, default None
97
- API key for Cloudmade or Mapbox tiles.
96
+ For more advanced tile layer options, use the `TileLayer` class.
98
97
min_zoom: int, default 0
99
98
Minimum allowed zoom level for the tile layer that is created.
100
99
max_zoom: int, default 18
101
100
Maximum allowed zoom level for the tile layer that is created.
102
- max_native_zoom: int, default None
103
- The highest zoom level at which the tile server can provide tiles.
104
- If provided you can zoom in past this level. Else tiles will turn grey.
105
101
zoom_start: int, default 10
106
102
Initial zoom level for the map.
107
103
attr: string, default None
108
104
Map tile attribution; only required if passing custom tile URL.
109
- detect_retina: bool, default False
110
- If true and user is on a retina display, it will request four
111
- tiles of half the specified size and a bigger zoom level in place
112
- of one to utilize the high resolution.
113
105
crs : str, default 'EPSG3857'
114
106
Defines coordinate reference systems for projecting geographical points
115
107
into pixel (screen) coordinates and back.
@@ -220,15 +212,32 @@ class Map(MacroElement):
220
212
{% endmacro %}
221
213
""" )
222
214
223
- def __init__ (self , location = None , width = '100%' , height = '100%' ,
224
- left = '0%' , top = '0%' , position = 'relative' ,
225
- tiles = 'OpenStreetMap' , API_key = None , max_zoom = 18 , min_zoom = 0 ,
226
- max_native_zoom = None , zoom_start = 10 , world_copy_jump = False ,
227
- no_wrap = False , attr = None , min_lat = - 90 , max_lat = 90 ,
228
- min_lon = - 180 , max_lon = 180 , max_bounds = False ,
229
- detect_retina = False , crs = 'EPSG3857' , control_scale = False ,
230
- prefer_canvas = False , no_touch = False , disable_3d = False ,
231
- subdomains = 'abc' , png_enabled = False , zoom_control = True ):
215
+ def __init__ (
216
+ self ,
217
+ location = None ,
218
+ width = '100%' ,
219
+ height = '100%' ,
220
+ left = '0%' ,
221
+ top = '0%' ,
222
+ position = 'relative' ,
223
+ tiles = 'OpenStreetMap' ,
224
+ attr = None ,
225
+ min_zoom = 0 ,
226
+ max_zoom = 18 ,
227
+ zoom_start = 10 ,
228
+ min_lat = - 90 ,
229
+ max_lat = 90 ,
230
+ min_lon = - 180 ,
231
+ max_lon = 180 ,
232
+ max_bounds = False ,
233
+ crs = 'EPSG3857' ,
234
+ control_scale = False ,
235
+ prefer_canvas = False ,
236
+ no_touch = False ,
237
+ disable_3d = False ,
238
+ png_enabled = False ,
239
+ zoom_control = True ,
240
+ ):
232
241
super (Map , self ).__init__ ()
233
242
self ._name = 'Map'
234
243
self ._env = ENV
@@ -274,12 +283,9 @@ def __init__(self, location=None, width='100%', height='100%',
274
283
self .objects_to_stay_in_front = []
275
284
276
285
if tiles :
277
- self .add_tile_layer (
278
- tiles = tiles , min_zoom = min_zoom , max_zoom = max_zoom ,
279
- max_native_zoom = max_native_zoom , no_wrap = no_wrap , attr = attr ,
280
- API_key = API_key , detect_retina = detect_retina ,
281
- subdomains = subdomains
282
- )
286
+ tile_layer = TileLayer (tiles = tiles , attr = attr ,
287
+ min_zoom = min_zoom , max_zoom = max_zoom )
288
+ self .add_child (tile_layer , name = tile_layer .tile_name )
283
289
284
290
def _repr_html_ (self , ** kwargs ):
285
291
"""Displays the HTML Map in a Jupyter notebook."""
@@ -329,24 +335,6 @@ def _repr_png_(self):
329
335
return None
330
336
return self ._to_png ()
331
337
332
- def add_tile_layer (self , tiles = 'OpenStreetMap' , name = None ,
333
- API_key = None , max_zoom = 18 , min_zoom = 0 ,
334
- max_native_zoom = None , attr = None , active = False ,
335
- detect_retina = False , no_wrap = False , subdomains = 'abc' ,
336
- ** kwargs ):
337
- """
338
- Add a tile layer to the map. See TileLayer for options.
339
-
340
- """
341
- tile_layer = TileLayer (tiles = tiles , name = name ,
342
- min_zoom = min_zoom , max_zoom = max_zoom ,
343
- max_native_zoom = max_native_zoom ,
344
- attr = attr , API_key = API_key ,
345
- detect_retina = detect_retina ,
346
- subdomains = subdomains ,
347
- no_wrap = no_wrap )
348
- self .add_child (tile_layer , name = tile_layer .tile_name )
349
-
350
338
def render (self , ** kwargs ):
351
339
"""Renders the HTML representation of the element."""
352
340
figure = self .get_root ()
0 commit comments