Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ksahbaz opened this issue Feb 14, 2024 · 2 comments · Fixed by #1909
Closed

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

ksahbaz opened this issue Feb 14, 2024 · 2 comments · Fixed by #1909
Labels
bug Something isn't working

Comments

@ksahbaz
Copy link

ksahbaz commented Feb 14, 2024

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
@ksahbaz ksahbaz added the bug Something isn't working label Feb 14, 2024
@ksahbaz ksahbaz changed the title Map.add_raster throws "TypeError:'dict' object is not callable" Map.add_raster throws "TypeError: 'dict' object is not callable" Feb 14, 2024
@giswqs
Copy link
Member

giswqs commented Feb 14, 2024

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.

@giswqs
Copy link
Member

giswqs commented Feb 14, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants