ITADN

unexpected errors on m.add_cog_layer()

#1248Closedcboettig 创建于 2025-11-08
bug
C
cboettigcommented
I'm getting an unexpected error on `.add_cog_layer()` that I believe was working quite recently? Not sure what I changed. The following errors: ```python import leafmap.maplibregl as leafmap m = leafmap.Map() m.add_cog_layer("https://espm-157.github.io/spatial-instructors-team/la_ndvi.tif", titiler_endpoint = "https://titiler.xyz", colormap_name = "greens") ``` with error trace: ``` TypeError Traceback (most recent call last) [/tmp/ipykernel_137783/1078261249.py](https://jupyterhub.cirrus.carlboettiger.info/tmp/ipykernel_137783/1078261249.py) in ?() 1 import leafmap.maplibregl as leafmap 2 m = leafmap.Map() ----> 3 m.add_cog_layer("https://espm-157.github.io/spatial-instructors-team/la_ndvi.tif", 4 titiler_endpoint = "http://titiler.xyz/", 5 colormap_name = "greens") 6 m [/opt/conda/lib/python3.12/site-packages/leafmap/maplibregl.py](https://jupyterhub.cirrus.carlboettiger.info/opt/conda/lib/python3.12/site-packages/leafmap/maplibregl.py) in ?(self, url, name, attribution, opacity, visible, bands, nodata, titiler_endpoint, fit_bounds, before_id, overwrite, **kwargs) 2216 overwrite=overwrite, 2217 ) 2218 if fit_bounds: 2219 bounds = common.cog_bounds(url, titiler_endpoint) -> 2220 self.fit_bounds([[bounds[0], bounds[1]], [bounds[2], bounds[3]]]) TypeError: 'NoneType' object is not subscriptable ``` on leafmap 0.54.0 on python 3.12 (ubuntu Linux) (Aside: I'm overriding the default back to titiler because "https://giswqs-titiler-endpoint.hf.space/" , the new default, seems to be down). The output from gdalinfo or leafmap.cog_validate() looks fine I think? so I don't believe there's a issue with the COG itself. It also shows up fine in this [earlier render from leafmap](https://espm-157.github.io/spatial-instructors-team/) ``` import leafmap leafmap.cog_validate("https://espm-157.github.io/spatial-instructors-team/la_ndvi.tif", verbose=True) ``` ``` Info(Path='https://espm-157.github.io/spatial-instructors-team/la_ndvi.tif', Driver='GTiff', COG=True, Compression='LZW', ColorSpace=None, COG_errors=None, COG_warnings=None, Profile=Profile(Bands=1, Width=909, Height=605, Tiled=True, Dtype='float64', Interleave='BAND', AlphaBand=False, InternalMask=False, Nodata=nan, ColorInterp=('gray',), ColorMap=False, Scales=(1.0,), Offsets=(0.0,)), GEO=Geo(CRS='EPSG:4326', BoundingBox=(-118.62244439844714, 33.69702206156433, -117.69674448140239, 34.31313696784824), Origin=(-118.62244439844714, 34.31313696784824), Resolution=(0.0010183717459238155, -0.001018371745923813), MinZoom=8, MaxZoom=10), Tags={'Image Metadata': {'AREA_OR_POINT': 'Area'}, 'Image Structure': {'LAYOUT': 'COG', 'COMPRESSION': 'LZW', 'INTERLEAVE': 'BAND'}}, Band_Metadata={'Band 1': BandMetadata(Description=None, ColorInterp='gray', Offset=0.0, Scale=1.0, Metadata={})}, IFD=[IFD(Level=0, Width=909, Height=605, Blocksize=(512, 512), Decimation=0), IFD(Level=1, Width=454, Height=302, Blocksize=(512, 512), Decimation=2)]) ```
关闭于 2025-11-09 6 条评论