Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
)
Expand Down
16 changes: 8 additions & 8 deletions docs/endpoints/stac.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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).
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/titiler/application/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/titiler/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand Down
16 changes: 8 additions & 8 deletions src/titiler/core/tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -233,17 +233,17 @@ 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")

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"]
Expand Down
29 changes: 25 additions & 4 deletions src/titiler/core/tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions src/titiler/core/titiler/core/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
)
Expand Down Expand Up @@ -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"],
},
},
)
Expand Down Expand Up @@ -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"],
},
},
)
Expand Down
2 changes: 1 addition & 1 deletion src/titiler/mosaic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
Expand Down