How to use the ipyleaflet.LayersControl function in ipyleaflet

To help you get started, we’ve selected a few ipyleaflet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fitoprincipe / ipygee / ipygee / map.py View on Github external
def show(self, tabs=True, layer_control=True, draw_control=False,
             fullscreen=True):
        """ Show the Map on the Notebook """
        if not self.is_shown:
            if layer_control:
                # Layers Control
                lc = ipyleaflet.LayersControl()
                self.add_control(lc)
            if draw_control:
                # Draw Control
                dc = ipyleaflet.DrawControl(edit=False)
                dc.on_draw(self.handle_draw)
                self.add_control(dc)
            if fullscreen:
                # Control
                full_control = ipyleaflet.FullScreenControl()
                self.add_control(full_control)

            if tabs:
                display(self, self.tab_widget)
            else:
                display(self)
        else:
github gee-community / gee_tools / geetools / ui / ipymap.py View on Github external
def show(self, tabs=True, layer_control=True, draw_control=False,
             fullscreen=True):
        """ Show the Map on the Notebook """
        if not self.is_shown:
            if layer_control:
                # Layers Control
                lc = ipyleaflet.LayersControl()
                self.add_control(lc)
            if draw_control:
                # Draw Control
                dc = ipyleaflet.DrawControl(edit=False)
                dc.on_draw(self.handle_draw)
                self.add_control(dc)
            if fullscreen:
                # Control
                full_control = ipyleaflet.FullScreenControl()
                self.add_control(full_control)

            if tabs:
                display(self, self.tab_widget)
            else:
                display(self)
        else:
github opendatacube / odc-tools / libs / ui / odc / ui / _map.py View on Github external
center = kw.pop('center', None)
            zoom = kw.pop('zoom', None)

            if center is None:
                center = (bbox.bottom + bbox.top)*0.5, (bbox.right + bbox.left)*0.5
            if zoom is None:
                zoom = zoom_from_bbox(bbox)

            height = kw.pop('height', '600px')
            width = kw.pop('width', None)

            m = Map(center=center, zoom=zoom, **kw)
            m.layout.height = height
            m.layout.width = width
            m.add_control(FullScreenControl())
            m.add_control(LayersControl())
        else:
            m = dst

        gg = GeoJSON(data={'type': 'FeatureCollection',
                           'features': polygons},
                     style=style,
                     hover_style={'color': 'tomato'},
                     name=layer_name)
        m.add_layer(gg)
        if dst is None:
            return m
        else:
            return gg