Esempio n. 1
0
 def _ipython_display_(self, **kwargs):
     if self._url is None:
         self.map = icp.MapView()
     else:
         default_tile = icp.TileMapLayer(url=self._url)
         self.map = icp.MapView(default_tiles=default_tile, crs=self._crs)
     self.layer = icp.MapVLayer(data_set=self._data, **self._layer_kwargs)
     self.map.add_layer(self.layer)
     self.map.fit_bounds = self.compute_bounds(self._data, lat_key=lambda d: d['geometry']['coordinates'][1],
                                               lng_key=lambda d: d['geometry']['coordinates'][0])
     self.map._ipython_display_(**kwargs)
Esempio n. 2
0
 def _ipython_display_(self, **kwargs):
     if self._url is None:
         self.map = icp.MapView()
     else:
         default_tile = icp.TileMapLayer(url=self._url)
         self.map = icp.MapView(default_tiles=default_tile, crs=self._crs)
     self.layer = icp.HeatLayer(heat_points=self._data,
                                **self._layer_kwargs)
     self.map.add_layer(self.layer)
     self.map.fit_bounds = self.compute_bounds(self._data,
                                               lat_key=lambda d: d[0],
                                               lng_key=lambda d: d[1])
     self.map._ipython_display_(**kwargs)
Esempio n. 3
0
 def _ipython_display_(self, **kwargs):
     if self._url is None:
         self.map = icp.MapView()
     else:
         default_tile = icp.TileMapLayer(url=self._url)
         self.map = icp.MapView(default_tiles=default_tile, crs=self._crs)
     self.layer = icp.RankSymbolThemeLayer(data=self._data,
                                           **self._layer_kwargs)
     self.map.add_layer(self.layer)
     self.map.fit_bounds = self.compute_bounds(self.layer.data,
                                               lat_key=lambda d: d[3],
                                               lng_key=lambda d: d[2])
     self.map._ipython_display_(**kwargs)
Esempio n. 4
0
 def _ipython_display_(self, **kwargs):
     self._widget._ipython_display_(**kwargs)
     job = self._detail_method()  #type:DistributedAnalystJob
     self._widget.update(job.state)
     while not job.state.endState:
         time.sleep(3)
         job = self._detail_method()  # type:DistributedAnalystJob
         self._widget.update(job.state)
     setting = job.setting  # type:SparkJobSetting
     for service_info in setting.serviceInfo.targetServiceInfos:
         if service_info.serviceType == TargetSericeType.RESTMAP:
             service_name = service_info.serviceAddress[
                 service_info.serviceAddress.rfind('/services/') +
                 len('/services/'):]
             map_service = self._map_service_fun(
                 service_name)  #type:MapService
             map_name = map_service.get_map_resources()[0].name
             map_info = map_service.get_map(map_name)
             bounds = map_info.bounds
             default_tiles = icp.TileMapLayer(
                 url=service_info.serviceAddress + '/maps/' + map_name)
             map = icp.MapView(
                 default_tiles=default_tiles,
                 crs='EPSG' + str(map_info.prjCoordSys.epsgCode),
                 fit_bounds=[[bounds.leftBottom.y, bounds.leftBottom.x],
                             [bounds.rightTop.y, bounds.rightTop.x]])
             map._ipython_display_(**kwargs)
     return job
Esempio n. 5
0
    def _ipython_display_(self, **kwargs):
        series = []
        i = 0
        self.prepare_total(self._data)
        while i < len(self._data):
            data = self._data[i]
            coords = self.compute_coords(data)
            datas = self.compute_pos(data)
            line_series = {
                "name": self._layer_option["names"][i],
                "type": 'lines',
                "coordinateSystem": 'leaflet',
                "zlevel": 2,
                "symbol": ['none', 'arrow'],
                "symbolSize": 10,
                "effect": {
                    "show": True,
                    "period": 6,
                    "trailLength": 0,
                    "symbol": self._layer_option["symbol"],
                    "symbolSize": self.compute_size(i)
                },
                "lineStyle": {
                    "normal": {
                        "color": self._layer_option["colors"][i] if "colors" in self._layer_option else '',
                        "width": 1,
                        "opacity": 0.6,
                        "curveness": 0.2
                    }
                },
                "data": coords
            }
            if line_series['effect']['symbol'] == 'plane':
                line_series['effect']['symbol'] = icp.SYMBOL['plane']
            scatter_series = {
                "name": self._layer_option["names"][i],
                "type": 'effectScatter',
                'coordinateSystem': 'leaflet',
                'zlevel': 2,
                'rippleEffect': {
                    'brushType': 'stroke'
                },
                'label': {
                    'normal': {
                        'show': True,
                        'position': 'right',
                        'formatter': '{b}'
                    }
                },
                'symbolSize': 5,
                'itemStyle': {
                    'normal': {
                        'color': self._layer_option["colors"][i] if "colors" in self._layer_option else ''
                    }
                },
                'data': datas
            }
            series.append(line_series)
            series.append(scatter_series)
            i = i + 1

        option = {
            "tooltip": {
                "trigger": 'item'
            },
            "legend": {
                "orient": 'vertical',
                "left": 'right',
                "data": self._layer_option["names"],
                "selectedMode": self._layer_option["selected_mode"],
                "selected": {
                    k: "selected_legend" not in self._layer_option or k in self._layer_option["selected_legend"] for k
                    in self._layer_option["names"]}
            },
            "series": series
        }
        if self._url is None:
            self.map = icp.MapView()
        else:
            default_tile = icp.TileMapLayer(url=self._url)
            self.map = icp.MapView(default_tiles=default_tile, crs=self._crs)
        self.layer = icp.EchartsLayer(option=option)
        self.map.fit_bounds = self.compute_bounds(self._all_feature, lat_key=lambda d: d["properties"]["cp"][1],
                                                  lng_key=lambda d: d["properties"]["cp"][0])
        self.map.add_layer(self.layer)
        self.map._ipython_display_(**kwargs)