MCPcopy Index your code
hub / github.com/opengeos/leafmap / __init__

Method __init__

leafmap/leafmap.py:34–214  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

32 return self._find_widget_of_type(map_widgets.LayerEditor)
33
34 def __init__(self, **kwargs):
35 if "center" not in kwargs:
36 kwargs["center"] = [20, 0]
37
38 if "zoom" not in kwargs:
39 kwargs["zoom"] = 2
40
41 if "max_zoom" not in kwargs:
42 kwargs["max_zoom"] = 24
43
44 if "scroll_wheel_zoom" not in kwargs:
45 kwargs["scroll_wheel_zoom"] = True
46
47 if "basemap" in kwargs:
48 if isinstance(kwargs["basemap"], str):
49 kwargs["basemap"] = get_basemap(kwargs["basemap"])
50
51 super().__init__(**kwargs)
52 self.baseclass = "ipyleaflet"
53 self.toolbar = None
54 self.toolbar_button = None
55 self.tool_output = None
56 self.tool_output_ctrl = None
57 self.layer_control = None
58 self.draw_control = None
59 self.search_control = None
60 self.user_roi = None
61 self.user_rois = None
62 self.draw_features = []
63 self.api_keys = {}
64 self.geojson_layers = []
65 self.edit_mode = False
66 self.edit_props = []
67 self._layer_manager_widget = widgets.VBox()
68
69 # sandbox path for Voila app to restrict access to system directories.
70 if "sandbox_path" not in kwargs:
71 if os.environ.get("USE_VOILA") is not None:
72 self.sandbox_path = os.getcwd()
73 else:
74 self.sandbox_path = None
75 else:
76 if os.path.exists(os.path.abspath(kwargs["sandbox_path"])):
77 self.sandbox_path = kwargs["sandbox_path"]
78 else:
79 print("The sandbox path is invalid.")
80 self.sandbox_path = None
81
82 if "height" not in kwargs:
83 self.layout.height = "600px"
84 else:
85 if isinstance(kwargs["height"], int):
86 kwargs["height"] = str(kwargs["height"]) + "px"
87 self.layout.height = kwargs["height"]
88 if "width" in kwargs:
89 if isinstance(kwargs["width"], int):
90 kwargs["width"] = str(kwargs["width"]) + "px"
91 self.layout.width = kwargs["width"]

Callers 1

__init__Method · 0.45

Calls 4

addMethod · 0.95
set_catalog_sourceMethod · 0.95
get_basemapFunction · 0.85
main_toolbarFunction · 0.85

Tested by

no test coverage detected