gee-community/geemap

Map.add_raster throws "TypeError: 'dict' object is not callable"

ksahbaz opened this issue · 2 comments

Environment Information

OS Windows CPU(s) 4 Machine AMD64
Architecture 64bit RAM 7.9 GiB Environment Jupyter
Python 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 07:53:56) [MSC v.1937 64 bit (AMD64)]
geemap 0.30.4 ee 0.1.389 ipyleaflet 0.18.2
folium 0.15.1 jupyterlab 3.5.3 notebook 6.5.4
ipyevents 2.0.2 localtileserver 0.10.1
Intel(R) oneAPI Math Kernel Library Version 2023.2-Product Build 20230613 for Intel(R) 64 architecture applications

Description

When I run add_raster function to add a local raster file (the code snippet from Single-band imagery), I get "TypeError:'dict' object is not callable".

What I Did

Map = geemap.Map()
Map.add_raster(filename, cmap='terrain', layer_name="DEM")
Map

Traceback

TypeError                                 Traceback (most recent call last)
c:\geemap\geemap4.ipynb Cell 3 line 2
      1 Map = geemap.Map()
----> 2 Map.add_raster(filename, cmap='terrain', layer_name="DEM")
      3 Map

File c:\ProgramData\miniconda3\envs\gee\Lib\site-packages\geemap\geemap.py:2428, in Map.add_raster(self, source, band, palette, vmin, vmax, nodata, attribution, layer_name, zoom_to_layer, visible, **kwargs)
   2426 if not hasattr(self, "cog_layer_dict"):
   2427     self.cog_layer_dict = {}
-> 2428 band_names = list(tile_client.metadata()["bands"].keys())
   2429 params = {
   2430     "tile_layer": tile_layer,
   2431     "tile_client": tile_client,
   (...)
   2435     "type": "LOCAL",
   2436 }
   2437 self.cog_layer_dict[layer_name] = params

TypeError: 'dict' object is not callable

I believe this issue has been fixed, but I have not made a new release yet. Try updating the package using geemap.update_package() and restart the kernel.

It seems the issue is caused by the recent localtileserver updates. I need to look into it.