How to specify reprojection method in TilerFactory
's XarrayReader
#1156
Answered
by
vincentsarago
davidbrochart
asked this question in
Q&A
-
An XarrayReader supports various values for reproject_method. How can one specify which method to use in a TilerFactory? |
Beta Was this translation helpful? Give feedback.
Answered by
vincentsarago
May 14, 2025
Replies: 1 comment 1 reply
-
there should be a titiler/src/titiler/xarray/titiler/xarray/dependencies.py Lines 108 to 114 in 08868e5 the If you want to have @dataclass
class DatasetParams(DefaultDependency):
"""Low level WarpedVRT Optional parameters."""
nodata: Annotated[
Optional[Union[str, int, float]],
Query(
title="Nodata value",
description="Overwrite internal Nodata value",
),
] = None
reproject_method: Annotated[
Optional[WarpResampling],
Query(
alias="reproject",
description="WarpKernel resampling algorithm (only used when doing re-projection). Defaults to `nearest`.",
),
] = "cubic" # default to cubic
def __post_init__(self):
"""Post Init."""
if self.nodata is not None:
self.nodata = numpy.nan if self.nodata == "nan" else float(self.nodata) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
davidbrochart
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
there should be a
reproject
query-parameter option available for the tile endpointstitiler/src/titiler/xarray/titiler/xarray/dependencies.py
Lines 108 to 114 in 08868e5
the
reproject
option is not defined a TilerFactory level but at endpoint level.If you want to have
reproject
to default to a specific value you'll have to create a customDatasetParams
dependency like: