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

Method add

leafmap/leafmap.py:216–255  ·  view source on GitHub ↗

Adds a layer to the map. Args: layer (object): The layer to add to the map. index (int, optional): The index at which to add the layer. Defaults to None.

(self, obj, index=None, **kwargs)

Source from the content-addressed store, hash-verified

214 self.set_catalog_source(kwargs["catalog_source"])
215
216 def add(self, obj, index=None, **kwargs) -> None:
217 """Adds a layer to the map.
218
219 Args:
220 layer (object): The layer to add to the map.
221 index (int, optional): The index at which to add the layer. Defaults to None.
222 """
223 if isinstance(obj, str):
224 if obj in basemaps.keys():
225 obj = get_basemap(obj)
226 else:
227 if obj == "nasa_earth_data":
228 from .toolbar import nasa_data_gui
229
230 nasa_data_gui(self, **kwargs)
231 elif obj == "NASA_OPERA":
232 from .toolbar import nasa_opera_gui
233
234 nasa_opera_gui(self, **kwargs)
235 elif obj == "inspector":
236 from .toolbar import inspector_gui
237
238 inspector_gui(self, **kwargs)
239
240 elif obj == "stac":
241 self.add_stac_gui(**kwargs)
242 elif obj == "basemap":
243 self.add_basemap_gui(**kwargs)
244 elif obj == "inspector":
245 self.add_inspector_gui(**kwargs)
246 elif obj == "layer_manager":
247 self.add_layer_manager(**kwargs)
248 elif obj == "oam":
249 self.add_oam_gui(**kwargs)
250 return
251
252 super().add(obj, index=index)
253
254 if hasattr(self, "_layer_manager_widget"):
255 self.update_layer_manager()
256
257 def set_center(self, lon, lat, zoom=None) -> None:
258 """Centers the map view at a given coordinates with the given zoom level.

Callers 15

__init__Method · 0.95
add_markerMethod · 0.95
add_basemapMethod · 0.95
add_layer_controlMethod · 0.95
add_wms_layerMethod · 0.95
add_tile_layerMethod · 0.95
add_vector_tileMethod · 0.95
add_pmtilesMethod · 0.95
add_minimapMethod · 0.95
marker_clusterMethod · 0.95
split_mapMethod · 0.95

Calls 10

add_stac_guiMethod · 0.95
add_basemap_guiMethod · 0.95
add_inspector_guiMethod · 0.95
add_layer_managerMethod · 0.95
add_oam_guiMethod · 0.95
update_layer_managerMethod · 0.95
get_basemapFunction · 0.85
nasa_data_guiFunction · 0.85
nasa_opera_guiFunction · 0.85
inspector_guiFunction · 0.85

Tested by

no test coverage detected