gee-community/geemap

local variable 'tile_layer' referenced before assignment

Closed this issue · 4 comments

Environment Information

mac geemap 0.19.0

Map.add_raster(dem, colormap='terrain', layer_name='DEM')

Description

when i followed this tutorial https://geemap.org/notebooks/25_load_rasters/, i came across a issue called "local variable 'tile_layer' referenced before assignment" when a run the line.

What I Did

i have searched similar issue on this github repo but nothing found

截屏2022-12-14 下午12 40 45

Did you install localtileserver?

yes, i did. the version is 0.6.1
截屏2022-12-14 下午5 28 30

i didn't end up use geemap add_raster to display my local raster tile because of the weird bug. Instead, i use folium.raster_layers.ImageOverlay to visualize my local tile on folium map.

with rasterio.open('my_tif.tif') as src:
    # Read the image as a NumPy array
    image = src.read()

width, height = src.width, src.height
bounds = src.bounds

m = folium.Map(location=[45.5236, -122.6750], zoom_start=13)

folium.raster_layers.ImageOverlay(
    image,
    bounds=[[bounds.top, bounds.left], [bounds.bottom, bounds.right]],
    opacity=1,
    name='My TIFF Layer',
    control=True
).add_to(m)

m
xu-teo commented

I've been facing the same issue as well and have localtileserver (0.7.1) installed.
Just checking if this may have been looked into since @benerain last raised this?
image