How to use the ipyleaflet.leaflet.TileLayer 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 jupyter-widgets / ipyleaflet / ipyleaflet / leaflet.py View on Github external
def _default_left_layer(self):
        return TileLayer()
github jupyter-widgets / ipyleaflet / ipyleaflet / leaflet.py View on Github external
def __init__(self, **kwargs):
        super(TileLayer, self).__init__(**kwargs)
        self.on_msg(self._handle_leaflet_event)
github jupyter-widgets / ipyleaflet / ipyleaflet / leaflet.py View on Github external
def basemap_to_tiles(bm, day='yesterday', **kwargs):
    # Format the URL with modisdate
    from datetime import date, timedelta
    if day == 'yesterday':
        yesterday = date.today() - timedelta(1)
        day = yesterday.strftime('%Y-%m-%d')
    url = bm.get('url', '')
    if url.count('%'):
        url = url % day
    return TileLayer(
        url=url,
        max_zoom=bm.get('max_zoom', 19),
        min_zoom=bm.get('min_zoom', 1),
        attribution=bm.get('attribution', ''),
        name=bm.get('name', ''),
        **kwargs
    )
github jupyter-widgets / ipyleaflet / ipyleaflet / leaflet.py View on Github external
def _default_right_layer(self):
        return TileLayer()
github jupyter-widgets / ipyleaflet / ipyleaflet / leaflet.py View on Github external
self._load_callbacks(**content)

    def on_load(self, callback, remove=False):
        self._load_callbacks.register_callback(callback, remove=remove)

    def redraw(self):
        self.send({'msg':'redraw'})

class LocalTileLayer(TileLayer):
    _view_name = Unicode('LeafletLocalTileLayerView').tag(sync=True)
    _model_name = Unicode('LeafletLocalTileLayerModel').tag(sync=True)

    path = Unicode('').tag(sync=True)


class WMSLayer(TileLayer):
    _view_name = Unicode('LeafletWMSLayerView').tag(sync=True)
    _model_name = Unicode('LeafletWMSLayerModel').tag(sync=True)

    service = Unicode('WMS').tag(sync=True)
    request = Unicode('GetMap').tag(sync=True)
    version = Unicode('1.1.1').tag(sync=True)

    # Options
    layers = Unicode().tag(sync=True, o=True)
    styles = Unicode().tag(sync=True, o=True)
    format = Unicode('image/jpeg').tag(sync=True, o=True)
    transparent = Bool(False).tag(sync=True, o=True)
    crs = Enum(values=allowed_crs, default_value='EPSG3857').tag(sync=True)
    uppercase = Bool(False).tag(sync=True, o=True)
github jupyter-widgets / ipyleaflet / ipyleaflet / leaflet.py View on Github external
def __init__(self, **kwargs):
        super(TileLayer, self).__init__(**kwargs)
        self.on_msg(self._handle_leaflet_event)

    def _handle_leaflet_event(self, _, content, buffers):
        if content.get('event', '') == 'load':
            self._load_callbacks(**content)

    def on_load(self, callback, remove=False):
        self._load_callbacks.register_callback(callback, remove=remove)

    def redraw(self):
        self.send({'msg':'redraw'})

class LocalTileLayer(TileLayer):
    _view_name = Unicode('LeafletLocalTileLayerView').tag(sync=True)
    _model_name = Unicode('LeafletLocalTileLayerModel').tag(sync=True)

    path = Unicode('').tag(sync=True)


class WMSLayer(TileLayer):
    _view_name = Unicode('LeafletWMSLayerView').tag(sync=True)
    _model_name = Unicode('LeafletWMSLayerModel').tag(sync=True)

    service = Unicode('WMS').tag(sync=True)
    request = Unicode('GetMap').tag(sync=True)
    version = Unicode('1.1.1').tag(sync=True)

    # Options
    layers = Unicode().tag(sync=True, o=True)