Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
# Check if layer exists
if name in self.EELayers.keys():
if not replace:
return self.getLayer(name)
else:
# Get URL, attribution & vis params
params = getImageTile(image, visParams, show, opacity)
# Remove Layer
self.removeLayer(name)
else:
# Get URL, attribution & vis params
params = getImageTile(image, visParams, show, opacity)
layer = ipyleaflet.TileLayer(url=params['url'],
attribution=params['attribution'],
name=name)
EELayer = {'type': 'Image',
'object': image,
'visParams': params['visParams'],
'layer': layer}
# self._add_EELayer(name, EELayer)
# return name
return EELayer
# Check if layer exists
if thename in self.EELayers.keys():
if not replace:
print("{} with name '{}' exists already, please choose another name".format(ty, thename))
return
else:
# Get URL, attribution & vis params
params = getImageTile(proxy_layer, img_params, show, opacity)
# Remove Layer
self.removeLayer(thename)
else:
# Get URL, attribution & vis params
params = getImageTile(proxy_layer, img_params, show, opacity)
layer = ipyleaflet.TileLayer(url=params['url'],
attribution=params['attribution'],
name=thename)
self._add_EELayer(thename, {'type': ty,
'object': feature,
'visParams': visParams,
'layer': layer})
return thename
from ipyleaflet import TileLayer
from traitlets import Unicode
from iclientpy._version import EXTENSION_VERSION
class CloudTileLayer(TileLayer):
"""
超图云图层
"""
_view_name = Unicode("SuperMapCloudTileLayerView").tag(sync=True)
_model_name = Unicode("SuperMapCloudTileLayerModel").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)
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 CloudTileLayer(TileLayer):
_view_name = Unicode("SuperMapCloudTileLayerView").tag(sync=True)
_model_name = Unicode("SuperMapCloudTileLayerModel").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)
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)
if not replace:
msg = "Image with name '{}' exists already, please choose " \
"another name"
print(msg.format(name))
return
else:
# Get URL, attribution & vis params
params = getImageTile(image, visParams, show, opacity)
# Remove Layer
self.removeLayer(name)
else:
# Get URL, attribution & vis params
params = getImageTile(image, visParams, show, opacity)
layer = ipyleaflet.TileLayer(url=params['url'],
attribution=params['attribution'],
name=name)
EELayer = {'type': 'Image',
'object': image,
'visParams': params['visParams'],
'layer': layer}
# self._add_EELayer(name, EELayer)
# return name
return EELayer
# Check if layer exists
if thename in self.EELayers.keys():
if not replace:
print("{} with name '{}' exists already, please choose another name".format(ty, thename))
return
else:
# Get URL, attribution & vis params
params = getImageTile(proxy_layer, img_params, show, opacity)
# Remove Layer
self.removeLayer(thename)
else:
# Get URL, attribution & vis params
params = getImageTile(proxy_layer, img_params, show, opacity)
layer = ipyleaflet.TileLayer(url=params['url'],
attribution=params['attribution'],
name=thename)
self._add_EELayer(thename, {'type': ty,
'object': feature,
'visParams': visParams,
'layer': layer})
return thename
def addBasemap(self, name, url, **kwargs):
""" Add a basemap with the given URL """
layer = ipyleaflet.TileLayer(url=url, name=name, base=True, **kwargs)
self.add_layer(layer)