@@ -197,9 +197,8 @@ def render(self, **kwargs):
197
197
vg.parse.spec(spec, function(chart) { chart({el:div}).update(); });}""" ), # noqa
198
198
name = 'vega_parse' )
199
199
200
-
201
- class GeoJson (MacroElement ):
202
- def __init__ (self , data , style_function = None ):
200
+ class GeoJson (Layer ):
201
+ def __init__ (self , data , style_function = None , name = None , overlay = True , control = True ):
203
202
"""
204
203
Creates a GeoJson plugin to append into a map with
205
204
Map.add_plugin.
@@ -215,6 +214,12 @@ def __init__(self, data, style_function=None):
215
214
* If str, then data will be passed to the JavaScript as-is.
216
215
style_function: function, default None
217
216
A function mapping a GeoJson Feature to a style dict.
217
+ name : string, default None
218
+ The name of the Layer, as it will appear in LayerControls
219
+ overlay : bool, default False
220
+ Whether the layer is optional (overlay) or compulsory.
221
+ control : bool, default True
222
+ Whether the Layer will be included in LayerControls
218
223
219
224
Examples
220
225
--------
@@ -233,7 +238,7 @@ def __init__(self, data, style_function=None):
233
238
... '#00ff00'}
234
239
>>> GeoJson(geojson, style_function=style_function)
235
240
"""
236
- super (GeoJson , self ).__init__ ()
241
+ super (GeoJson , self ).__init__ (name = name , overlay = overlay , control = control )
237
242
self ._name = 'GeoJson'
238
243
if hasattr (data , 'read' ):
239
244
self .embed = True
@@ -316,14 +321,20 @@ def _get_self_bounds(self):
316
321
]
317
322
return bounds
318
323
319
-
320
- class TopoJson (MacroElement ):
321
- def __init__ (self , data , object_path , style_function = None ):
324
+ class TopoJson (Layer ):
325
+ def __init__ (self , data , object_path , name = None , overlay = True , control = True ):
322
326
"""
323
327
TODO docstring here
324
328
329
+ name : string, default None
330
+ The name of the Layer, as it will appear in LayerControls
331
+ overlay : bool, default False
332
+ Whether the layer is optional (overlay) or compulsory.
333
+ control : bool, default True
334
+ Whether the Layer will be included in LayerControls
335
+
325
336
"""
326
- super (TopoJson , self ).__init__ ()
337
+ super (TopoJson , self ).__init__ (name = name , overlay = overlay , control = control )
327
338
self ._name = 'TopoJson'
328
339
if 'read' in dir (data ):
329
340
self .embed = True
0 commit comments