gee-community/geemap

135 segmentation - Exception during adding raster / shape file to Map

FaranIdo opened this issue · 4 comments

Environment Information

I use Google Colab (TPU)

Description

Hello,
I tried to run step 135 of the tutorial - https://geemap.org/notebooks/135_segmentation on google colab.
The segmentation worked fine, but the steps of adding the results to the Map did not work:

Map.add_raster("annotations.tif", alpha=0.5, layer_name="Masks")
Map

image


style = {
    "color": "#3388ff",
    "weight": 2,
    "fillColor": "#7c4185",
    "fillOpacity": 0.5,
}
Map.add_vector('masks.shp', layer_name="Vector", style=style)
Map

image

What I Did

I tried to run the following commands, both worked:
!pip install geemap[raster]
!pip install localtileserver

and then:
import localtileserver

and got the following exception:
image

giswqs commented

Make sure you restart the kernel after installing localtileserver

I tried running it from scratch, and adding:

 !pip install -U geemap
!pip install localtileserver
 %pip install segment-geospatial
import ee
import geemap
import localtileserver
from samgeo import SamGeo

And now I receive the following exception:
image

Ok managed to solve it by playing with the imports + pip order, I will create a PR to fix it on the tutorial himself:

@giswqs I forgot to submit a PR, thanks for the fix!