def __init__(self, location=None, width='100%', height='100%', left='0%', top='0%', position='relative', tiles='OpenStreetMap', API_key=None, max_zoom=18, min_zoom=0, max_native_zoom=None, zoom_start=10, world_copy_jump=False, no_wrap=False, attr=None, min_lat=-90, max_lat=90, min_lon=-180, max_lon=180, max_bounds=False, detect_retina=False, crs='EPSG3857', control_scale=False, prefer_canvas=False, no_touch=False, disable_3d=False, subdomains='abc', png_enabled=False, zoom_control=True): super(Map, self).__init__() self._name = 'Map' self._env = ENV # Undocumented for now b/c this will be subject to a re-factor soon. self._png_image = None self.png_enabled = png_enabled if location is None: # If location is not passed we center and zoom out. self.location = [0, 0] self.zoom_start = 1 else: self.location = _validate_location(location) self.zoom_start = zoom_start Figure().add_child(self) # Map Size Parameters. self.width = _parse_size(width) self.height = _parse_size(height) self.left = _parse_size(left) self.top = _parse_size(top) self.position = position self.min_lat = min_lat self.max_lat = max_lat self.min_lon = min_lon self.max_lon = max_lon self.max_bounds = max_bounds self.no_wrap = no_wrap self.world_copy_jump = world_copy_jump self.crs = crs self.control_scale = control_scale self.zoom_control = zoom_control self.global_switches = GlobalSwitches( prefer_canvas, no_touch, disable_3d ) self.objects_to_stay_in_front = [] if tiles: self.add_tile_layer( tiles=tiles, min_zoom=min_zoom, max_zoom=max_zoom, max_native_zoom=max_native_zoom, no_wrap=no_wrap, attr=attr, API_key=API_key, detect_retina=detect_retina, subdomains=subdomains )
def __init__(self, data, width=None, height=None, left='0%', top='0%', position='relative'): super(VegaLite, self).__init__() self._name = 'VegaLite' self.data = data.to_json() if hasattr(data, 'to_json') else data if isinstance(self.data, text_type) or isinstance(data, binary_type): self.data = json.loads(self.data) # Size Parameters. self.width = _parse_size(self.data.get('width', '100%') if width is None else width) self.height = _parse_size(self.data.get('height', '100%') if height is None else height) self.left = _parse_size(left) self.top = _parse_size(top) self.position = position
def __init__( self, location=None, width='100%', height='100%', left='0%', top='0%', position='relative', tiles='OpenStreetMap', attr=None, min_zoom=0, max_zoom=18, zoom_start=10, min_lat=-90, max_lat=90, min_lon=-180, max_lon=180, max_bounds=False, crs='EPSG3857', control_scale=False, prefer_canvas=False, no_touch=False, disable_3d=False, png_enabled=False, zoom_control=True, **kwargs ): super(Map, self).__init__() self._name = 'Map' self._env = ENV # Undocumented for now b/c this will be subject to a re-factor soon. self._png_image = None self.png_enabled = png_enabled if location is None: # If location is not passed we center and zoom out. self.location = [0, 0] zoom_start = 1 else: self.location = validate_location(location) Figure().add_child(self) # Map Size Parameters. self.width = _parse_size(width) self.height = _parse_size(height) self.left = _parse_size(left) self.top = _parse_size(top) self.position = position max_bounds_array = [[min_lat, min_lon], [max_lat, max_lon]] \ if max_bounds else None self.crs = crs self.control_scale = control_scale self.options = parse_options( max_bounds=max_bounds_array, zoom=zoom_start, zoom_control=zoom_control, prefer_canvas=prefer_canvas, **kwargs ) self.global_switches = GlobalSwitches( no_touch, disable_3d ) self.objects_to_stay_in_front = [] if tiles: tile_layer = TileLayer(tiles=tiles, attr=attr, min_zoom=min_zoom, max_zoom=max_zoom) self.add_child(tile_layer, name=tile_layer.tile_name)
def __init__( self, location=None, width='100%', height='100%', left='0%', top='0%', position='relative', tiles='OpenStreetMap', attr=None, min_zoom=0, max_zoom=18, zoom_start=10, min_lat=-90, max_lat=90, min_lon=-180, max_lon=180, max_bounds=False, crs='EPSG3857', control_scale=False, prefer_canvas=False, no_touch=False, disable_3d=False, png_enabled=False, zoom_control=True, **kwargs ): super(Map, self).__init__() self._name = 'Map' self._env = ENV # Undocumented for now b/c this will be subject to a re-factor soon. self._png_image = None self.png_enabled = png_enabled if location is None: # If location is not passed we center and zoom out. self.location = [0, 0] zoom_start = 1 else: self.location = validate_location(location) Figure().add_child(self) # Map Size Parameters. self.width = _parse_size(width) self.height = _parse_size(height) self.left = _parse_size(left) self.top = _parse_size(top) self.position = position max_bounds_array = [[min_lat, min_lon], [max_lat, max_lon]] \ if max_bounds else None self.crs = crs self.control_scale = control_scale self.options = parse_options( max_bounds=max_bounds_array, zoom=zoom_start, zoom_control=zoom_control, prefer_canvas=prefer_canvas, **kwargs ) self.global_switches = GlobalSwitches( no_touch, disable_3d ) self.objects_to_stay_in_front = [] if tiles: tile_layer = TileLayer(tiles=tiles, attr=attr, min_zoom=min_zoom, max_zoom=max_zoom) self.add_child(tile_layer, name=tile_layer.tile_name)