local variable 'tile_layer' referenced before assignment
Closed this issue · 4 comments
benerain commented
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
giswqs commented
Did you install localtileserver?
benerain commented
benerain commented
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