MCPcopy
hub / github.com/gee-community/geemap / add

Method add

geemap/geemap.py:274–315  ·  view source on GitHub ↗

Adds a layer or control to the map. Args: obj: The layer or control to add to the map. position: The position of the control on the map. Defaults to "topright". **kwargs: Additional keyword arguments.

(self, obj: str | Any, position: str = "topright", **kwargs: Any)

Source from the content-addressed store, hash-verified

272 )
273
274 def add(self, obj: str | Any, position: str = "topright", **kwargs: Any) -> None:
275 """Adds a layer or control to the map.
276
277 Args:
278 obj: The layer or control to add to the map.
279 position: The position of the control on the map. Defaults to "topright".
280 **kwargs: Additional keyword arguments.
281 """
282 if isinstance(obj, str):
283 basemap = check_basemap(obj)
284 if basemap in basemaps.keys():
285 super().add(get_basemap(basemap))
286 return
287
288 if not isinstance(obj, str):
289 super().add(obj, position=position, **kwargs)
290 return
291
292 obj = obj.lower()
293
294 backward_compatibilities = {
295 "zoom_ctrl": "zoom_control",
296 "fullscreen_ctrl": "fullscreen_control",
297 "scale_ctrl": "scale_control",
298 "toolbar_ctrl": "toolbar",
299 "draw_ctrl": "draw_control",
300 "data_ctrl": "search_control",
301 "search_ctrl": "search_control",
302 }
303 obj = backward_compatibilities.get(obj, obj)
304 if obj == "measure_ctrl":
305 measure = ipyleaflet.MeasureControl(
306 position=position,
307 active_color="orange",
308 primary_length_unit="kilometers",
309 )
310 self.add(measure, position=position)
311 elif obj == "layer_ctrl":
312 layer_control = ipyleaflet.LayersControl(position=position)
313 self.add(layer_control, position=position)
314 else:
315 super().add(obj, position=position, **kwargs)
316
317 def add_controls(
318 self, controls: list[Any] | Any, position: str = "topleft"

Callers 15

add_controlsMethod · 0.95
set_optionsMethod · 0.95
add_basemapMethod · 0.95
add_tile_layerMethod · 0.95
set_plot_optionsMethod · 0.95
plotMethod · 0.95
add_layer_controlMethod · 0.95
add_toolbarMethod · 0.95
add_markerMethod · 0.95
add_wms_layerMethod · 0.95
zoom_to_meMethod · 0.95
add_minimapMethod · 0.95

Calls 3

check_basemapFunction · 0.85
get_basemapFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected