diff --git a/CHANGES.md b/CHANGES.md index 53af36d45..12891a166 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,21 @@ # Release Notes +## 0.5.0 (TBD) + +* update rio-tiler/morecantile/rio-cogeo/cogeo-mosaic versions + +**breaking change** + +* Multi-band expression now uses semicolon `;` instead of colon (`,`) as separator. Note: proper urlencoding might be needed. + +```python +# before +expression = "b1+b2,b2" + +# new +expression = "b1+b2;b2" +``` + ## 0.4.3 (2022-02-08) * add tile `buffer` option to match rio-tiler tile options (https://github.com/developmentseed/titiler/pull/427) diff --git a/docs/advanced/dependencies.md b/docs/advanced/dependencies.md index 49da33a4f..ac748e73a 100644 --- a/docs/advanced/dependencies.md +++ b/docs/advanced/dependencies.md @@ -120,8 +120,8 @@ The `factories` allow users to set multiple default dependencies. Here is the li examples={ "simple": {"description": "Simple band math.", "value": "b1/b2"}, "multi-bands": { - "description": "Coma (,) delimited expressions (band1: b1/b2, band2: b2+b3).", - "value": "b1/b2,b2+b3", + "description": "Semicolon (;) delimited expressions (band1: b1/b2, band2: b2+b3).", + "value": "b1/b2;b2+b3", }, }, ) diff --git a/docs/endpoints/stac.md b/docs/endpoints/stac.md index 32f9a1037..6c613047a 100644 --- a/docs/endpoints/stac.md +++ b/docs/endpoints/stac.md @@ -50,7 +50,7 @@ app.include_router(stac.router, prefix="/stac", tags=["SpatioTemporal Asset Cata - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`). - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. @@ -83,7 +83,7 @@ Example: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`). - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **max_size** (int): Max image size, default is 1024. - **height** (int): Force output image height. @@ -123,7 +123,7 @@ Example: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`). - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **max_size** (int): Max image size, default is 1024. - **nodata** (str, int, float): Overwrite internal Nodata value. @@ -159,7 +159,7 @@ Example: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`). - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **max_size** (int): Max image size, default is 1024. - **nodata** (str, int, float): Overwrite internal Nodata value. @@ -193,7 +193,7 @@ Example: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`). - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **nodata** (str, int, float): Overwrite internal Nodata value. - **unscale** (bool): Apply dataset internal Scale/Offset. @@ -217,7 +217,7 @@ Example: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. - **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`). - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **tile_format** (str): Output image format, default is set to None and will be either JPEG or PNG depending on masked value. - **tile_scale** (int): Tile size scale, default is set to 1 (256x256). @@ -290,7 +290,7 @@ Example: - QueryParams: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. Default to all available assets. - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **max_size** (int): Max image size from which to calculate statistics, default is 1024. - **height** (int): Force image height from which to calculate statistics. @@ -317,7 +317,7 @@ Example: - QueryParams: - **url** (str): STAC Item URL. **Required** - **assets** (array[str]): asset names. Default to all available assets. - - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`). + - **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`). - **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`). - **max_size** (int): Max image size from which to calculate statistics, default is 1024. - **height** (int): Force image height from which to calculate statistics. diff --git a/src/titiler/application/setup.py b/src/titiler/application/setup.py index a8f650667..1fa8dd6df 100644 --- a/src/titiler/application/setup.py +++ b/src/titiler/application/setup.py @@ -6,7 +6,7 @@ long_description = f.read() inst_reqs = [ - "rio-cogeo>=3.0,<4.0", + "rio-cogeo>=3.1,<4.0", "titiler.core>=0.4,<0.5", "titiler.mosaic>=0.4,<0.5", "starlette-cramjam>=0.1.0,<0.2", diff --git a/src/titiler/core/setup.py b/src/titiler/core/setup.py index 6018d831e..06cda76b2 100644 --- a/src/titiler/core/setup.py +++ b/src/titiler/core/setup.py @@ -6,13 +6,13 @@ long_description = f.read() inst_reqs = [ - "fastapi>=0.65,!=0.68.0,!=0.68.1,!=0.68.2,!=0.69.0,!=0.70.0,!=0.70.1,!=0.71.0,!=0.72.0", + "fastapi>=0.73.0", "geojson-pydantic", "jinja2>=2.11.2,<4.0.0", "numpy", "pydantic", "rasterio", - "rio-tiler>=3.0,<3.1", + "rio-tiler>=3.1,<3.2", "simplejson", "importlib_resources>=1.1.0;python_version<'3.9'", "typing_extensions;python_version<'3.8'", diff --git a/src/titiler/core/tests/test_dependencies.py b/src/titiler/core/tests/test_dependencies.py index 6e90bbe44..45078fc24 100644 --- a/src/titiler/core/tests/test_dependencies.py +++ b/src/titiler/core/tests/test_dependencies.py @@ -120,15 +120,15 @@ def _expre(params=Depends(dependencies.ExpressionParams)): response = client.get("/second?bidx=1&bidx=2") assert response.json()["indexes"] == [1, 2] - response = client.get("/second?expression=1,2") - assert response.json()["expression"] == "1,2" + response = client.get("/second", params={"expression": "1;2"}) + assert response.json()["expression"] == "1;2" response = client.get("/second") assert not response.json()["expression"] assert not response.json()["indexes"] - response = client.get("/third?expression=1,2") - assert response.json() == "1,2" + response = client.get("/third", params={"expression": "1;2"}) + assert response.json() == "1;2" response = client.get("/third") assert not response.json() @@ -233,8 +233,8 @@ def _bands_expr_opt(params=Depends(dependencies.BandsExprParamsOptional)): response = client.get("/second?bands=b1&bands=b2") assert response.json()["bands"] == ["b1", "b2"] - response = client.get("/second?expression=b1,b2") - assert response.json()["expression"] == "b1,b2" + response = client.get("/second", params={"expression": "b1;b2"}) + assert response.json()["expression"] == "b1;b2" with pytest.raises(errors.MissingBands): response = client.get("/second") @@ -242,8 +242,8 @@ def _bands_expr_opt(params=Depends(dependencies.BandsExprParamsOptional)): response = client.get("/third?bands=b1&bands=b2") assert response.json()["bands"] == ["b1", "b2"] - response = client.get("/third?expression=b1,b2") - assert response.json()["expression"] == "b1,b2" + response = client.get("/third", params={"expression": "b1;b2"}) + assert response.json()["expression"] == "b1;b2" response = client.get("/third") assert not response.json()["bands"] diff --git a/src/titiler/core/tests/test_factories.py b/src/titiler/core/tests/test_factories.py index 5355e8262..7d933968a 100644 --- a/src/titiler/core/tests/test_factories.py +++ b/src/titiler/core/tests/test_factories.py @@ -93,7 +93,12 @@ def test_TilerFactory(): assert meta["height"] == 256 response = client.get( - f"/tiles/8/87/48.tif?url={DATA_DIR}/cog.tif&expression=b1,b1,b1&return_mask=false" + "/tiles/8/87/48.tif", + params={ + "url": f"{DATA_DIR}/cog.tif", + "expression": "b1;b1;b1", + "return_mask": False, + }, ) assert response.status_code == 200 assert response.headers["content-type"] == "image/tiff; application=geotiff" @@ -648,7 +653,12 @@ def test_MultiBaseTilerFactory(rio): assert meta["count"] == 2 response = client.get( - f"/preview.tif?url={DATA_DIR}/item.json&expression=B01,B01,B01&return_mask=false" + "/preview.tif", + params={ + "url": f"{DATA_DIR}/item.json", + "expression": "B01;B01;B01", + "return_mask": False, + }, ) assert response.status_code == 200 assert response.headers["content-type"] == "image/tiff; application=geotiff" @@ -666,7 +676,13 @@ def test_MultiBaseTilerFactory(rio): assert meta["count"] == 3 response = client.get( - f"/preview.tif?url={DATA_DIR}/item.json&assets=B01&asset_expression=B01|b1,b1,b1&return_mask=false" + "/preview.tif", + params={ + "url": f"{DATA_DIR}/item.json", + "assets": "B01", + "asset_expression": "B01|b1;b1;b1", + "return_mask": False, + }, ) assert response.status_code == 200 assert response.headers["content-type"] == "image/tiff; application=geotiff" @@ -896,7 +912,12 @@ def test_MultiBandTilerFactory(): assert meta["count"] == 3 response = client.get( - f"/preview.tif?directory={DATA_DIR}&expression=B01,B09,B01&return_mask=false" + "/preview.tif", + params={ + "directory": DATA_DIR, + "expression": "B01;B09;B01", + "return_mask": False, + }, ) assert response.status_code == 200 assert response.headers["content-type"] == "image/tiff; application=geotiff" diff --git a/src/titiler/core/titiler/core/dependencies.py b/src/titiler/core/titiler/core/dependencies.py index 43d021400..705f7fec1 100644 --- a/src/titiler/core/titiler/core/dependencies.py +++ b/src/titiler/core/titiler/core/dependencies.py @@ -118,8 +118,8 @@ class ExpressionParams(DefaultDependency): examples={ "simple": {"description": "Simple band math.", "value": "b1/b2"}, "multi-bands": { - "description": "Coma (,) delimited expressions (band1: b1/b2, band2: b2+b3).", - "value": "b1/b2,b2+b3", + "description": "Semicolon (;) delimited expressions (band1: b1/b2, band2: b2+b3).", + "value": "b1/b2;b2+b3", }, }, ) @@ -193,11 +193,11 @@ class AssetsBidxExprParams(DefaultDependency): examples={ "one-asset": { "description": "Return indexes 1,2,3 of asset `data`.", - "value": ["data|1,2,3"], + "value": ["data|1;2;3"], }, "multi-assets": { "description": "Return indexes 1,2,3 of asset `data` and indexes 1 of asset `cog`", - "value": ["data|1,2,3", "cog|1"], + "value": ["data|1;2;3", "cog|1"], }, }, ) @@ -249,11 +249,11 @@ class AssetsBidxParams(AssetsParams): examples={ "one-asset": { "description": "Return indexes 1,2,3 of asset `data`.", - "value": ["data|1,2,3"], + "value": ["data|1;2;3"], }, "multi-assets": { "description": "Return indexes 1,2,3 of asset `data` and indexes 1 of asset `cog`", - "value": ["data|1,2,3", "cog|1"], + "value": ["data|1;2;3", "cog|1"], }, }, ) diff --git a/src/titiler/mosaic/setup.py b/src/titiler/mosaic/setup.py index fcc65692f..b5b3db289 100644 --- a/src/titiler/mosaic/setup.py +++ b/src/titiler/mosaic/setup.py @@ -5,7 +5,7 @@ with open("README.md") as f: long_description = f.read() -inst_reqs = ["titiler.core>=0.4,<0.5", "cogeo-mosaic>=4.0,<4.1"] +inst_reqs = ["titiler.core>=0.4,<0.5", "cogeo-mosaic>=4.1,<4.2"] extra_reqs = { "test": ["pytest", "pytest-cov", "pytest-asyncio", "requests"], }