diff --git a/CHANGES.md b/CHANGES.md index 898323ab1..fa7df6ff0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,26 +1,42 @@ # Release Notes +## 0.14.0 (unreleased) + +### titiler.core + +* replace `-` by `_` in query parameters **breaking change** + - `coord-crs` -> `coord_crs` + - `dst-crs` -> `dst_crs` + +* replace `buffer` and `color_formula` endpoint parameters by external dependencies (`BufferParams` and `ColorFormulaParams`) + +### titiler.extension + +* rename `geom-densify-pts` to `geometry_densify` **breaking change** +* rename `geom-precision` to `geometry_precision` **breaking change** + + ## 0.13.3 (2023-08-27) -- fix Factories `url_for` method and avoid changing `Request.path_params` object +* fix Factories `url_for` method and avoid changing `Request.path_params` object ## 0.13.2 (2023-08-24) ### titiler.extensions -- replace mapbox-gl by maplibre -- replace Stamen by OpenStreetMap tiles -- simplify band selection handling (author @tayden, https://github.com/developmentseed/titiler/pull/688) +* replace mapbox-gl by maplibre +* replace Stamen by OpenStreetMap tiles +* simplify band selection handling (author @tayden, https://github.com/developmentseed/titiler/pull/688) ## 0.13.1 (2023-08-21) ### titiler.core -- fix `LowerCaseQueryStringMiddleware` unexpectedly truncating query parameters (authors @jthetzel and @jackharrhy, @https://github.com/developmentseed/titiler/pull/677) +* fix `LowerCaseQueryStringMiddleware` unexpectedly truncating query parameters (authors @jthetzel and @jackharrhy, @https://github.com/developmentseed/titiler/pull/677) ## titiler.application -- add `cors_allow_methods` in `ApiSettings` to control the CORS allowed methods (author @ubi15, https://github.com/developmentseed/titiler/pull/684) +* add `cors_allow_methods` in `ApiSettings` to control the CORS allowed methods (author @ubi15, https://github.com/developmentseed/titiler/pull/684) ## 0.13.0 (2023-07-27) diff --git a/docs/src/endpoints/cog.md b/docs/src/endpoints/cog.md index a46133403..1c9e5fe3f 100644 --- a/docs/src/endpoints/cog.md +++ b/docs/src/endpoints/cog.md @@ -113,7 +113,7 @@ Example: - **url** (str): Cloud Optimized GeoTIFF URL. **Required** - **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`). - **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`). - - **coord-crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. - **max_size** (int): Max image size, default is 1024. - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. @@ -149,7 +149,7 @@ Example: - **url** (str): Cloud Optimized GeoTIFF URL. **Required** - **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`). - **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`). - - **coord-crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. - **max_size** (int): Max image size, default is 1024. - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. @@ -184,7 +184,7 @@ Note: if `height` and `width` are provided `max_size` will be ignored. - **url** (str): Cloud Optimized GeoTIFF URL. **Required** - **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`). - **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`). - - **coord-crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. - **resampling** (str): rasterio resampling method. Default is `nearest`. @@ -323,7 +323,7 @@ Example: - **url** (str): Cloud Optimized GeoTIFF URL. **Required** - **bidx** (array[int]): Dataset band indexes (e.g `bidx=1`, `bidx=1&bidx=2&bidx=3`). - **expression** (str): rio-tiler's band math expression (e.g `expression=b1/b2`). - - **coord-crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. - **max_size** (int): Max image size from which to calculate statistics, default is 1024. - **height** (int): Force image height from which to calculate statistics. - **width** (int): Force image width from which to calculate statistics. diff --git a/docs/src/endpoints/stac.md b/docs/src/endpoints/stac.md index cb108bcb0..0f2ab2cfd 100644 --- a/docs/src/endpoints/stac.md +++ b/docs/src/endpoints/stac.md @@ -124,7 +124,7 @@ Example: - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1_b1/Asset2_b1`). - **asset_as_band** (bool): tell rio-tiler that each asset is a 1 band dataset, so expression `Asset1/Asset2` can be passed. - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). - - **coord-crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. - **max_size** (int): Max image size, default is 1024. - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. @@ -163,7 +163,7 @@ Example: - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1_b1/Asset2_b1`). - **asset_as_band** (bool): tell rio-tiler that each asset is a 1 band dataset, so expression `Asset1/Asset2` can be passed. - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). - - **coord-crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. - **max_size** (int): Max image size, default is 1024. - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. @@ -200,7 +200,7 @@ Example: - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1_b1/Asset2_b1`). - **asset_as_band** (bool): tell rio-tiler that each asset is a 1 band dataset, so expression `Asset1/Asset2` can be passed. - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). - - **coord-crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input coordinates. Default to `epsg:4326`. - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. - **resampling** (str): rasterio resampling method. Default is `nearest`. @@ -392,7 +392,7 @@ Example: - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1_b1/Asset2_b1`). - **asset_as_band** (bool): tell rio-tiler that each asset is a 1 band dataset, so expression `Asset1/Asset2` can be passed. - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). - - **coord-crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. + - **coord_crs** (str): Coordinate Reference System of the input geometry coordinates. Default to `epsg:4326`. - **max_size** (int): Max image size from which to calculate statistics, default is 1024. - **height** (int): Force image height from which to calculate statistics. - **width** (int): Force image width from which to calculate statistics. diff --git a/src/titiler/core/tests/test_factories.py b/src/titiler/core/tests/test_factories.py index 701f411cb..4aa42553e 100644 --- a/src/titiler/core/tests/test_factories.py +++ b/src/titiler/core/tests/test_factories.py @@ -201,7 +201,7 @@ def test_TilerFactory(): assert response.json()["band_names"] == ["b1"] response = client.get( - f"/point/-6259272.328324187,12015838.020930404?url={DATA_DIR}/cog.tif&coord-crs=EPSG:3857" + f"/point/-6259272.328324187,12015838.020930404?url={DATA_DIR}/cog.tif&coord_crs=EPSG:3857" ) assert response.status_code == 200 assert response.headers["content-type"] == "application/json" @@ -1591,7 +1591,7 @@ def custom_rescale_params() -> Optional[RescaleType]: def test_dst_crs_option(): - """test dst-crs parameter.""" + """test dst_crs parameter.""" app = FastAPI() app.include_router(TilerFactory().router) @@ -1605,7 +1605,7 @@ def test_dst_crs_option(): 32621 ) # return the image in the original CRS - response = client.get(f"/preview.tif?url={DATA_DIR}/cog.tif&dst-crs=epsg:4326") + response = client.get(f"/preview.tif?url={DATA_DIR}/cog.tif&dst_crs=epsg:4326") meta = parse_img(response.content) assert meta["crs"] == CRS.from_epsg(4326) assert not meta["crs"] == CRS.from_epsg(32621) @@ -1622,20 +1622,20 @@ def test_dst_crs_option(): # Force output in epsg:32621 response = client.get( - f"/crop/-56.228,72.715,-54.547,73.188.tif?url={DATA_DIR}/cog.tif&dst-crs=epsg:32621" + f"/crop/-56.228,72.715,-54.547,73.188.tif?url={DATA_DIR}/cog.tif&dst_crs=epsg:32621" ) meta = parse_img(response.content) assert meta["crs"] == CRS.from_epsg(32621) - # coord-crs + dst-crs + # coord_crs + dst_crs response = client.get( - f"/crop/-6259272.328324187,12015838.020930404,-6072144.264300693,12195445.265479913.tif?url={DATA_DIR}/cog.tif&coord-crs=epsg:3857" + f"/crop/-6259272.328324187,12015838.020930404,-6072144.264300693,12195445.265479913.tif?url={DATA_DIR}/cog.tif&coord_crs=epsg:3857" ) meta = parse_img(response.content) assert meta["crs"] == CRS.from_epsg(3857) response = client.get( - f"/crop/-6259272.328324187,12015838.020930404,-6072144.264300693,12195445.265479913.tif?url={DATA_DIR}/cog.tif&coord-crs=epsg:3857&dst-crs=epsg:32621" + f"/crop/-6259272.328324187,12015838.020930404,-6072144.264300693,12195445.265479913.tif?url={DATA_DIR}/cog.tif&coord_crs=epsg:3857&dst_crs=epsg:32621" ) meta = parse_img(response.content) assert meta["crs"] == CRS.from_epsg(32621) diff --git a/src/titiler/core/titiler/core/dependencies.py b/src/titiler/core/titiler/core/dependencies.py index 577e9219e..3ebf11eaf 100644 --- a/src/titiler/core/titiler/core/dependencies.py +++ b/src/titiler/core/titiler/core/dependencies.py @@ -486,7 +486,7 @@ def CoordCRSParams( crs: Annotated[ Optional[str], Query( - alias="coord-crs", + alias="coord_crs", description="Coordinate Reference System of the input coords. Default to `epsg:4326`.", ), ] = None, @@ -502,7 +502,7 @@ def DstCRSParams( crs: Annotated[ Optional[str], Query( - alias="dst-crs", + alias="dst_crs", description="Output Coordinate Reference System.", ), ] = None, @@ -512,3 +512,30 @@ def DstCRSParams( return CRS.from_user_input(crs) return None + + +def BufferParams( + buffer: Annotated[ + Optional[float], + Query( + gt=0, + title="Tile buffer.", + description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", + ), + ] = None, +) -> Optional[float]: + """Tile buffer Parameter.""" + return buffer + + +def ColorFormulaParams( + color_formula: Annotated[ + Optional[str], + Query( + title="Color Formula", + description="rio-color formula (info: https://github.com/mapbox/rio-color)", + ), + ] = None, +) -> Optional[str]: + """ColorFormula Parameter.""" + return color_formula diff --git a/src/titiler/core/titiler/core/factory.py b/src/titiler/core/titiler/core/factory.py index 9961581e4..e4c3e18f0 100644 --- a/src/titiler/core/titiler/core/factory.py +++ b/src/titiler/core/titiler/core/factory.py @@ -37,6 +37,8 @@ BandsExprParamsOptional, BandsParams, BidxExprParams, + BufferParams, + ColorFormulaParams, ColorMapParams, CoordCRSParams, DatasetParams, @@ -521,23 +523,10 @@ def tile( src_path=Depends(self.path_dependency), layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), @@ -625,23 +614,10 @@ def tilejson( ] = None, layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), @@ -718,23 +694,10 @@ def map_viewer( ] = None, layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), @@ -793,23 +756,10 @@ def wmts( ] = None, layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), @@ -940,13 +890,7 @@ def preview( image_params=Depends(self.img_dependency), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), @@ -1018,13 +962,7 @@ def part( image_params=Depends(self.img_dependency), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), @@ -1089,13 +1027,7 @@ def geojson_crop( image_params=Depends(self.img_dependency), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), reader_params=Depends(self.reader_dependency), diff --git a/src/titiler/extensions/titiler/extensions/stac.py b/src/titiler/extensions/titiler/extensions/stac.py index 865209a89..257a851fe 100644 --- a/src/titiler/extensions/titiler/extensions/stac.py +++ b/src/titiler/extensions/titiler/extensions/stac.py @@ -113,7 +113,7 @@ def create_stac( geom_densify_pts: Annotated[ Optional[int], Query( - alias="geom-densify-pts", + alias="geometry_densify", ge=0, description="Number of points to add to each edge to account for nonlinear edges transformation.", ), @@ -121,7 +121,7 @@ def create_stac( geom_precision: Annotated[ Optional[int], Query( - alias="geom-precision", + alias="geometry_precision", ge=-1, description="Round geometry coordinates to this number of decimal.", ), diff --git a/src/titiler/extensions/titiler/extensions/wms.py b/src/titiler/extensions/titiler/extensions/wms.py index f3073f3c9..964330289 100644 --- a/src/titiler/extensions/titiler/extensions/wms.py +++ b/src/titiler/extensions/titiler/extensions/wms.py @@ -2,22 +2,21 @@ from dataclasses import dataclass, field from enum import Enum -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List from urllib.parse import urlencode import jinja2 import numpy import rasterio -from fastapi import Depends, HTTPException, Query +from fastapi import Depends, HTTPException from rasterio.crs import CRS from rio_tiler.mosaic import mosaic_reader from rio_tiler.mosaic.methods.base import MosaicMethodBase from starlette.requests import Request from starlette.responses import Response from starlette.templating import Jinja2Templates -from typing_extensions import Annotated -from titiler.core.dependencies import RescalingParams +from titiler.core.dependencies import ColorFormulaParams, RescalingParams from titiler.core.factory import BaseTilerFactory, FactoryExtension from titiler.core.resources.enums import ImageType, MediaType @@ -271,13 +270,7 @@ def wms( # noqa: C901 dataset_params=Depends(factory.dataset_dependency), post_process=Depends(factory.process_dependency), rescale=Depends(RescalingParams), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(factory.colormap_dependency), reader_params=Depends(factory.reader_dependency), env=Depends(factory.environment_dependency), diff --git a/src/titiler/mosaic/tests/test_factory.py b/src/titiler/mosaic/tests/test_factory.py index 22dfa5c1f..d5db4e8ff 100644 --- a/src/titiler/mosaic/tests/test_factory.py +++ b/src/titiler/mosaic/tests/test_factory.py @@ -100,7 +100,7 @@ def test_MosaicTilerFactory(): response = client.get( "/mosaic/point/-7903683.846322423,5780349.220256353", - params={"url": mosaic_file, "coord-crs": "epsg:3857"}, + params={"url": mosaic_file, "coord_crs": "epsg:3857"}, ) assert response.status_code == 200 @@ -213,7 +213,7 @@ def test_MosaicTilerFactory(): response = client.get( "/mosaic/-7903683.846322423,5780349.220256353/assets", - params={"url": mosaic_file, "coord-crs": "epsg:3857"}, + params={"url": mosaic_file, "coord_crs": "epsg:3857"}, ) assert response.status_code == 200 assert all( @@ -233,7 +233,7 @@ def test_MosaicTilerFactory(): response = client.get( "/mosaic/-8453323.83211421,5322463.153553393,-8140237.76425813,5635549.221409473/assets", - params={"url": mosaic_file, "coord-crs": "epsg:3857"}, + params={"url": mosaic_file, "coord_crs": "epsg:3857"}, ) assert response.status_code == 200 assert all( diff --git a/src/titiler/mosaic/titiler/mosaic/factory.py b/src/titiler/mosaic/titiler/mosaic/factory.py index 4debb54b2..71acf287e 100644 --- a/src/titiler/mosaic/titiler/mosaic/factory.py +++ b/src/titiler/mosaic/titiler/mosaic/factory.py @@ -24,7 +24,12 @@ from starlette.responses import HTMLResponse, Response from typing_extensions import Annotated -from titiler.core.dependencies import CoordCRSParams, DefaultDependency +from titiler.core.dependencies import ( + BufferParams, + ColorFormulaParams, + CoordCRSParams, + DefaultDependency, +) from titiler.core.factory import BaseTilerFactory, img_endpoint_params from titiler.core.models.mapbox import TileJSON from titiler.core.resources.enums import ImageType, MediaType, OptionalHeader @@ -265,23 +270,10 @@ def tile( layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), pixel_selection=Depends(self.pixel_selection_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), backend_params=Depends(self.backend_dependency), @@ -402,23 +394,10 @@ def tilejson( layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), pixel_selection=Depends(self.pixel_selection_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), post_process=Depends(self.process_dependency), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), backend_params=Depends(self.backend_dependency), @@ -508,22 +487,9 @@ def map_viewer( layer_params=Depends(self.layer_dependency), dataset_params=Depends(self.dataset_dependency), pixel_selection=Depends(self.pixel_selection_dependency), - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, + buffer=Depends(BufferParams), rescale=Depends(self.rescale_dependency), - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, + color_formula=Depends(ColorFormulaParams), colormap=Depends(self.colormap_dependency), render_params=Depends(self.render_dependency), backend_params=Depends(self.backend_dependency), @@ -581,28 +547,15 @@ def wmts( Optional[int], Query(description="Overwrite default maxzoom."), ] = None, - layer_params=Depends(self.layer_dependency), # noqa - dataset_params=Depends(self.dataset_dependency), # noqa - pixel_selection=Depends(self.pixel_selection_dependency), # noqa - buffer: Annotated[ - Optional[float], - Query( - gt=0, - title="Tile buffer.", - description="Buffer on each side of the given tile. It must be a multiple of `0.5`. Output **tilesize** will be expanded to `tilesize + 2 * buffer` (e.g 0.5 = 257x257, 1.0 = 258x258).", - ), - ] = None, - post_process=Depends(self.process_dependency), # noqa - rescale=Depends(self.rescale_dependency), # noqa - color_formula: Annotated[ - Optional[str], - Query( - title="Color Formula", - description="rio-color formula (info: https://github.com/mapbox/rio-color)", - ), - ] = None, - colormap=Depends(self.colormap_dependency), # noqa - render_params=Depends(self.render_dependency), # noqa + layer_params=Depends(self.layer_dependency), + dataset_params=Depends(self.dataset_dependency), + pixel_selection=Depends(self.pixel_selection_dependency), + buffer=Depends(BufferParams), + post_process=Depends(self.process_dependency), + rescale=Depends(self.rescale_dependency), + color_formula=Depends(ColorFormulaParams), + colormap=Depends(self.colormap_dependency), + render_params=Depends(self.render_dependency), backend_params=Depends(self.backend_dependency), reader_params=Depends(self.reader_dependency), env=Depends(self.environment_dependency),