@@ -197,9 +197,8 @@ def render(self, **kwargs):
197197 vg.parse.spec(spec, function(chart) { chart({el:div}).update(); });}""" ), # noqa
198198 name = 'vega_parse' )
199199
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 ):
203202 """
204203 Creates a GeoJson plugin to append into a map with
205204 Map.add_plugin.
@@ -215,6 +214,12 @@ def __init__(self, data, style_function=None):
215214 * If str, then data will be passed to the JavaScript as-is.
216215 style_function: function, default None
217216 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
218223
219224 Examples
220225 --------
@@ -233,7 +238,7 @@ def __init__(self, data, style_function=None):
233238 ... '#00ff00'}
234239 >>> GeoJson(geojson, style_function=style_function)
235240 """
236- super (GeoJson , self ).__init__ ()
241+ super (GeoJson , self ).__init__ (name = name , overlay = overlay , control = control )
237242 self ._name = 'GeoJson'
238243 if hasattr (data , 'read' ):
239244 self .embed = True
@@ -316,14 +321,20 @@ def _get_self_bounds(self):
316321 ]
317322 return bounds
318323
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 ):
322326 """
323327 TODO docstring here
324328
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+
325336 """
326- super (TopoJson , self ).__init__ ()
337+ super (TopoJson , self ).__init__ (name = name , overlay = overlay , control = control )
327338 self ._name = 'TopoJson'
328339 if 'read' in dir (data ):
329340 self .embed = True
0 commit comments