4545from titiler .core .utils import render_image
4646from titiler .mosaic .factory import PixelSelectionParams
4747from titiler .stacapi .backend import STACAPIBackend
48- from titiler .stacapi .dependencies import APIParams , STACApiParams , STACSearchParams
48+ from titiler .stacapi .dependencies import (
49+ APIParams ,
50+ STACApiParams ,
51+ STACQueryParams ,
52+ STACSearchParams ,
53+ )
4954from titiler .stacapi .models import FeatureInfo , LayerDict
5055from titiler .stacapi .pystac import Client
5156from titiler .stacapi .settings import CacheSettings , RetrySettings
@@ -723,12 +728,12 @@ class OGCWMTSFactory(BaseTilerFactory):
723728
724729 path_dependency : Callable [..., APIParams ] = STACApiParams
725730
726- search_dependency : Callable [..., Dict ] = STACSearchParams
727-
728731 # In this factory, `reader` should be a Mosaic Backend
729732 # https://developmentseed.org/cogeo-mosaic/advanced/backends/
730733 reader : Type [BaseBackend ] = STACAPIBackend
731734
735+ query_dependency : Callable [..., Any ] = STACQueryParams
736+
732737 # Because the endpoints should work with STAC Items,
733738 # the `layer_dependency` define which query parameters are mandatory/optional to `display` images
734739 # Defaults to `titiler.core.dependencies.AssetsBidxExprParams`, `assets=` or `expression=` is required
@@ -806,7 +811,6 @@ def get_tile( # noqa: C901
806811 # STAC Query parameter provided by the the render extension and QueryParameters
807812 ###########################################################
808813 query_params = copy (layer .get ("render" )) or {}
809- query_params ["collections" ] = [layer ["collection" ]]
810814
811815 if req_time :
812816 start_datetime = python_datetime .datetime .strptime (
@@ -825,9 +829,10 @@ def get_tile( # noqa: C901
825829 query_params ["expression" ] = req ["expression" ]
826830
827831 search_query = get_dependency_params (
828- dependency = self .search_dependency ,
832+ dependency = self .query_dependency ,
829833 query_params = query_params ,
830834 )
835+ search_query ["collections" ] = [layer ["collection" ]]
831836
832837 layer_params = get_dependency_params (
833838 dependency = self .layer_dependency ,
0 commit comments