Repository navigation
Did something changed when loading .tif files? #1325
Replies: 2 comments 1 reply
|
The recent localtileserver might have broken the colab workflow. Need to look into it |
|
This specific Colab/webview raster-rendering problem has now been fixed in Leafmap 0.63.0. The failure was not caused by your loop over the GeoTIFF files. The MapLibre backend created a raw local tile URL such as Leafmap PR #1337 updated
In Colab, upgrade Leafmap and localtileserver using the active kernel interpreter: import sys
!{sys.executable} -m pip install -U "leafmap[maplibre]>=0.63.0" "localtileserver>=1.0.0"Then restart the Colab runtime before importing Leafmap again. Confirm the versions: import leafmap
import localtileserver
print("leafmap:", leafmap.__version__)
print("localtileserver:", localtileserver.__version__)Your loop can then remain essentially unchanged: import os
import leafmap
m = leafmap.Map(center=[-32.866, -60.324], zoom=10)
for filename in os.listdir("data/descargas"):
if filename.lower().endswith((".tif", ".tiff")):
path = os.path.join("data/descargas", filename)
m.add_raster(
path,
layer_name=os.path.splitext(filename)[0],
)
mIf a layer still does not appear after the version upgrade and runtime restart, check that the downloaded file is a readable GeoTIFF with a CRS and valid bounds: import rasterio
with rasterio.open(path) as src:
print(src.crs, src.bounds, src.count, src.dtypes, src.nodata)But for the behavior reported here—no exception, layer added, raster invisible in Colab—the loopback routing bug addressed by Leafmap 0.63.0 is the direct match. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi, community!
I am reaching you out because of the following situation. I am downloading some s2 images using the STAC API, but the problem I am facing is that when I try to display them using leafmap, they are not shown. I tried my workflow a few weeks ago and it worked perfect. Now, when I try reproduce it again, I can't. Did something changed in the last weeks?
This is basically my workflow in Google Colab.
FROM HERE DOESN'T WORK (it's not that I am getting an error, it is just my images are not being displayed)
Thank you so much in advance!! :)
All reactions