How to use the ipyleaflet.Layer 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 SuperMap / iclient-python / jupyter / iclientpy / jupyter / widget.py View on Github external
maxslider = IntSlider(value=1,
                              min=0,
                              max=math.ceil(self.max),
                              step=1,
                              description='max:',
                              disabled=False,
                              continuous_update=False,
                              orientation='horizontal',
                              readout=True,
                              readout_format='d',
                              layout=Layout(width="350px"))
        link((maxslider, 'value'), (self, 'max'))
        return widgets.VBox([radiusintslider, minopacityslider, blurintslider, maxslider])


class MapVLayer(Layer):
    _view_name = Unicode("SuperMapMapVLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapMapVLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    data_set = List([]).tag(sync=True)
    map_v_options = Dict().tag(sync=True)

    @validate('map_v_options')
    def _validate_map_v_options(self, proposal):
        self.size = proposal['value']['size'] if 'size' in proposal['value']else 5
        self.global_alpha = proposal['value']['globalAlpha'] if 'globalAlpha' in proposal['value'] else 1
        self.fill_style = proposal['value']['fillStyle'] if 'fillStyle' in proposal['value'] else'#3732FA'
        self.shadow_color = proposal['value']['shadowColor'] if 'shadowColor' in proposal['value'] else'#FFFA32'
github SuperMap / iclient-python / iclientpy / iclientpy / jupyter / widgets / ranksymbolthemelayer.py View on Github external
circle_hover_style_fill_opacity = Float(default_value=0.8).tag(chs=True)  #:鼠标悬浮时圆的透明度
    circle_hover_style = Dict().tag(settings=True)  #:鼠标悬浮时样式

    @default('circle_hover_style')
    def _default_circle_hover_style(self):
        tmp_chs = {}
        for name in self.traits(chs=True):
            v = getattr(self, name)
            if not v:
                continue
            tmp_chs[name] = v
        return tmp_chs


class RankSymbolThemeLayer(Layer):
    """
    等级符号专题图图层
    """
    _view_name = Unicode("SuperMapRankSymbolThemeLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapRankSymbolThemeLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    theme_field = Unicode('value').tag(sync=True)  #:主题字段
    symbol_type = Unicode('CIRCLE').tag(sync=True)  #:类型,当前只支持Circle
    symbol_setting = Any({}).tag(sync=True)  #:样式设置
    name = Unicode('').tag(sync=True)  #:名称
    data = Any([]).tag(sync=True)  #:展示数据
    is_over_lay = Bool(True).tag(sync=True, o=True)  #:是否压盖
github SuperMap / iclient-python / iclientpy / iclientpy / jupyter / widgets / heatlayer.py View on Github external
import math
from ipyleaflet import Layer
from ipywidgets import IntSlider, FloatSlider, VBox, Layout
from traitlets import Unicode, List, Int, Float, Dict, validate, link
from iclientpy._version import EXTENSION_VERSION


class HeatLayer(Layer):
    """
    热力图图层
    """
    _view_name = Unicode("SuperMapHeatLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapHeatLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    heat_points = List([]).tag(sync=True)  #:热力点数据

    @validate('heat_points')
    def _validate_heat_points(self, proposal):
        if (proposal['value'] is None):
            raise Exception("error data")
github SuperMap / iclient-python / jupyter / iclientpy / jupyter / widget.py View on Github external
from ipyleaflet import Map, TileLayer, Layer
from traitlets import Unicode, List, Int, default, validate, Dict, Any, Tuple, link, Bool, Float, CaselessStrEnum
from ipywidgets import Layout, IntRangeSlider, ColorPicker, IntSlider, FloatSlider
import ipywidgets as widgets
import pandas as pd
import geojson
import os
import math
from .._version import EXTENSION_VERSION


class HeatLayer(Layer):
    _view_name = Unicode("SuperMapHeatLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapHeatLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    heat_points = List([]).tag(sync=True)

    @validate('heat_points')
    def _validate_heat_points(self, proposal):
        if (proposal['value'] is None):
            raise Exception("error data")
        self.max = max(dt[2] for dt in self.heat_points)
        return proposal['value']
github SuperMap / iclient-python / iclientpy / iclientpy / jupyter / widgets / mapvlayer.py View on Github external
global_alpha = Float(1).tag(settings=True)  #:透明度

    @validate('global_alpha')
    def _validate_global_alpha(self, proposal):
        if (proposal['value'] > 1 or proposal['value'] < 0):
            raise Exception("透明度范围是0-1之间")
        return proposal['value']

    gradient = Dict(allow_none=True).tag(settings=True)  #:渐变颜色值设置
    draw = CaselessStrEnum(
        ["simple", "time", "heatmap", "grid", "honeycomb", "bubble", "intensity", "category", "choropleth", "text",
         "icon"], default_value="honeycomb").tag(settings=True)  #:类型


class MapVLayer(Layer):
    """
     mapv图层,可以用于创建蜂巢图等
    """

    _view_name = Unicode("SuperMapMapVLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapMapVLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    data_set = List([]).tag(sync=True)  #:数据源
    map_v_options = Any().tag(sync=True)  #:mapv样式

    @validate('map_v_options')
    def _validate_map_v_options(self, proposal):
github SuperMap / iclient-python / jupyter / iclientpy / jupyter / widget.py View on Github external
url = Unicode('').tag(sync=True)
    attribution = Unicode('').tag(sync=True, o=True)
    map_name = Unicode('').tag(sync=True, o=True)
    type = Unicode('').tag(sync=True, o=True)


class TileMapLayer(TileLayer):
    _view_name = Unicode("SuperMapTileMapLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapTileMapLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)


class RankSymbolThemeLayer(Layer):
    _view_name = Unicode("SuperMapRankSymbolThemeLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapRankSymbolThemeLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    theme_field = Unicode('value').tag(sync=True)
    symbol_type = Unicode('CIRCLE').tag(sync=True)
    symbol_setting = Dict({}).tag(sync=True)
    name = Unicode('').tag(sync=True)
    sdata = Any([])
    data = List([]).tag(sync=True)
    is_over_lay = Bool(True).tag(sync=True, o=True)
    address_key = Any(0)
    value_key = Any(1)
github SuperMap / iclient-python / iclientpy / iclientpy / jupyter / widgets / echartslayer.py View on Github external
from ipyleaflet import Layer
from traitlets import Unicode, Dict
from iclientpy._version import EXTENSION_VERSION

SYMBOL = {
    "plane": 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.'
             '063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.'
             '305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.'
             '799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.'
             '531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134'
             '.449-92.931l12.238-241.308L1705.06,1318.313z'
}


class EchartsLayer(Layer):
    _view_name = Unicode("SuperMapEchartsLayerView").tag(sync=True)
    _model_name = Unicode("SuperMapEchartsLayerModel").tag(sync=True)
    _view_module = Unicode("iclientpy").tag(sync=True)
    _model_module = Unicode("iclientpy").tag(sync=True)
    _view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
    _model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

    option = Dict().tag(sync=True)