opengeos / segment-geospatial

A Python package for segmenting geospatial data with the Segment Anything Model (SAM)
https://samgeo.gishub.org
MIT License
2.88k stars 286 forks source link

TypeError: TileClient.__init__() got an unexpected keyword argument 'cors_all' #309

Open brianmcdonald opened 3 weeks ago

brianmcdonald commented 3 weeks ago

Environment Information

Description

I am trying to run the examples, but getting an error when creating the interactive maps. For instance, while running input_prompts.ipynb, the cell

m.layers[-1].visible = False
m.add_raster(image, layer_name="Image")
m

gives the error:

Exception ignored in: <function TileClient.__del__ at 0x33ad61120>
Traceback (most recent call last):
  File "[/Users/brian/miniforge3/envs/eth/lib/python3.12/site-packages/localtileserver/server.py", line 152](http://localhost:8888/Users/brian/miniforge3/envs/eth/lib/python3.12/site-packages/localtileserver/server.py#line=151), in __del__
    self.shutdown()
  File "[/Users/brian/miniforge3/envs/eth/lib/python3.12/site-packages/localtileserver/server.py", line 174](http://localhost:8888/Users/brian/miniforge3/envs/eth/lib/python3.12/site-packages/localtileserver/server.py#line=173), in shutdown
    shutdown_server(self._key, force=force)
                    ^^^^^^^^^
AttributeError: 'TileClient' object has no attribute '_key'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[/var/folders/q2/r6cyvbjx443d2txp6kr8tl_h0000gn/T/ipykernel_61098/3537108183.py](http://localhost:8888/var/folders/q2/r6cyvbjx443d2txp6kr8tl_h0000gn/T/ipykernel_61098/3537108183.py) in ?()
      1 m.layers[-1].visible = False
----> 2 m.add_raster(image, layer_name="Image")
      3 m

[~/miniforge3/envs/eth/lib/python3.12/site-packages/leafmap/leafmap.py](http://localhost:8888/~/miniforge3/envs/eth/lib/python3.12/site-packages/leafmap/leafmap.py) in ?(self, source, indexes, colormap, vmin, vmax, nodata, attribution, layer_name, layer_index, zoom_to_layer, visible, opacity, array_args, client_args, **kwargs)
   2351 
   2352         if isinstance(source, np.ndarray) or isinstance(source, xr.DataArray):
   2353             source = array_to_image(source, **array_args)
   2354 
-> 2355         tile_layer, tile_client = get_local_tile_layer(
   2356             source,
   2357             indexes=indexes,
   2358             colormap=colormap,

[~/miniforge3/envs/eth/lib/python3.12/site-packages/leafmap/common.py](http://localhost:8888/~/miniforge3/envs/eth/lib/python3.12/site-packages/leafmap/common.py) in ?(source, port, debug, indexes, colormap, vmin, vmax, nodata, attribution, tile_format, layer_name, client_args, return_client, quiet, **kwargs)
   2958         else:
   2959             layer_name = "LocalTile_" + random_string(3)
   2960 
   2961     if isinstance(source, str) or isinstance(source, rasterio.io.DatasetReader):
-> 2962         tile_client = TileClient(source, port=port, debug=debug, **client_args)
   2963     else:
   2964         tile_client = source
   2965 

TypeError: TileClient.__init__() got an unexpected keyword argument 'cors_all'

What I Did

created the an env and installed the required packages

giswqs commented 2 weeks ago

Can you try update the packages?

pip install -U leafmap localtileserver