Skip to content

Commit

Permalink
Revert change to factory
Browse files Browse the repository at this point in the history
  • Loading branch information
abarciauskas-bgse committed Jun 5, 2024
1 parent 55e5775 commit 28574cd
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions titiler/stacapi/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from urllib.parse import urlencode

import jinja2
import rasterio
from cogeo_mosaic.backends import BaseBackend
from fastapi import Depends, HTTPException, Path, Query
from fastapi.dependencies.utils import get_dependant, request_params_to_args
Expand Down Expand Up @@ -194,32 +195,35 @@ def tile(
scale = scale or 1

tms = self.supported_tms.get(tileMatrixSetId)
with self.reader(
url=api_params["api_url"],
headers=api_params.get("headers", {}),
tms=tms,
reader_options={**reader_params},
**backend_params,
) as src_dst:
if MOSAIC_STRICT_ZOOM and (z < src_dst.minzoom or z > src_dst.maxzoom):
raise HTTPException(
400,
f"Invalid ZOOM level {z}. Should be between {src_dst.minzoom} and {src_dst.maxzoom}",
with rasterio.Env(**env):
with self.reader(
url=api_params["api_url"],
headers=api_params.get("headers", {}),
tms=tms,
reader_options={**reader_params},
**backend_params,
) as src_dst:
if MOSAIC_STRICT_ZOOM and (
z < src_dst.minzoom or z > src_dst.maxzoom
):
raise HTTPException(
400,
f"Invalid ZOOM level {z}. Should be between {src_dst.minzoom} and {src_dst.maxzoom}",
)

image, assets = src_dst.tile(
x,
y,
z,
search_query=search_query,
tilesize=scale * 256,
pixel_selection=pixel_selection,
threads=MOSAIC_THREADS,
**tile_params,
**layer_params,
**dataset_params,
)

image, assets = src_dst.tile(
x,
y,
z,
search_query=search_query,
tilesize=scale * 256,
pixel_selection=pixel_selection,
threads=MOSAIC_THREADS,
**tile_params,
**layer_params,
**dataset_params,
)

if post_process:
image = post_process(image)

Expand Down

0 comments on commit 28574cd

Please sign in to comment.