Handle 404 for raster that doesn't exist

pull/1067/head
Piero Toffanin 2021-10-05 18:08:35 -04:00
rodzic 33878c7571
commit 10757ae710
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -309,13 +309,13 @@ class Tiles(TaskNestedView):
nodata = np.nan if nodata == "nan" else float(nodata)
tilesize = scale * 256
url = get_raster_path(task, tile_type)
if not os.path.isfile(url):
raise exceptions.NotFound()
with COGReader(url) as src:
if not src.tile_exists(z, x, y):
raise exceptions.NotFound("Outside of bounds")
if not os.path.isfile(url):
raise exceptions.NotFound()
with COGReader(url) as src:
minzoom, maxzoom = get_zoom_safe(src)
has_alpha = has_alpha_band(src.dataset)