Skip to content

Commit 0e7de05

Browse files
update titiler requirements (#436)
1 parent feaa2aa commit 0e7de05

File tree

9 files changed

+69
-32
lines changed

9 files changed

+69
-32
lines changed

CHANGES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Release Notes
22

3+
## 0.5.0 (TBD)
4+
5+
* update rio-tiler/morecantile/rio-cogeo/cogeo-mosaic versions
6+
7+
**breaking change**
8+
9+
* Multi-band expression now uses semicolon `;` instead of colon (`,`) as separator. Note: proper urlencoding might be needed.
10+
11+
```python
12+
# before
13+
expression = "b1+b2,b2"
14+
15+
# new
16+
expression = "b1+b2;b2"
17+
```
18+
319
## 0.4.3 (2022-02-08)
420

521
* add tile `buffer` option to match rio-tiler tile options (https://github.com/developmentseed/titiler/pull/427)

docs/advanced/dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ The `factories` allow users to set multiple default dependencies. Here is the li
120120
examples={
121121
"simple": {"description": "Simple band math.", "value": "b1/b2"},
122122
"multi-bands": {
123-
"description": "Coma (,) delimited expressions (band1: b1/b2, band2: b2+b3).",
124-
"value": "b1/b2,b2+b3",
123+
"description": "Semicolon (;) delimited expressions (band1: b1/b2, band2: b2+b3).",
124+
"value": "b1/b2;b2+b3",
125125
},
126126
},
127127
)

docs/endpoints/stac.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ app.include_router(stac.router, prefix="/stac", tags=["SpatioTemporal Asset Cata
5050
- **url** (str): STAC Item URL. **Required**
5151
- **assets** (array[str]): asset names.
5252
- **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`).
53-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
53+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
5454
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
5555
- **nodata** (str, int, float): Overwrite internal Nodata value.
5656
- **unscale** (bool): Apply dataset internal Scale/Offset.
@@ -83,7 +83,7 @@ Example:
8383
- **url** (str): STAC Item URL. **Required**
8484
- **assets** (array[str]): asset names.
8585
- **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`).
86-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
86+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
8787
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
8888
- **max_size** (int): Max image size, default is 1024.
8989
- **height** (int): Force output image height.
@@ -123,7 +123,7 @@ Example:
123123
- **url** (str): STAC Item URL. **Required**
124124
- **assets** (array[str]): asset names.
125125
- **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`).
126-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
126+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
127127
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
128128
- **max_size** (int): Max image size, default is 1024.
129129
- **nodata** (str, int, float): Overwrite internal Nodata value.
@@ -159,7 +159,7 @@ Example:
159159
- **url** (str): STAC Item URL. **Required**
160160
- **assets** (array[str]): asset names.
161161
- **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`).
162-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
162+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
163163
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
164164
- **max_size** (int): Max image size, default is 1024.
165165
- **nodata** (str, int, float): Overwrite internal Nodata value.
@@ -193,7 +193,7 @@ Example:
193193
- **url** (str): STAC Item URL. **Required**
194194
- **assets** (array[str]): asset names.
195195
- **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`).
196-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
196+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
197197
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
198198
- **nodata** (str, int, float): Overwrite internal Nodata value.
199199
- **unscale** (bool): Apply dataset internal Scale/Offset.
@@ -217,7 +217,7 @@ Example:
217217
- **url** (str): STAC Item URL. **Required**
218218
- **assets** (array[str]): asset names.
219219
- **expression** (str): rio-tiler's math expression with asset names (e.g `Asset1/Asset2`).
220-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
220+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
221221
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
222222
- **tile_format** (str): Output image format, default is set to None and will be either JPEG or PNG depending on masked value.
223223
- **tile_scale** (int): Tile size scale, default is set to 1 (256x256).
@@ -290,7 +290,7 @@ Example:
290290
- QueryParams:
291291
- **url** (str): STAC Item URL. **Required**
292292
- **assets** (array[str]): asset names. Default to all available assets.
293-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
293+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
294294
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
295295
- **max_size** (int): Max image size from which to calculate statistics, default is 1024.
296296
- **height** (int): Force image height from which to calculate statistics.
@@ -317,7 +317,7 @@ Example:
317317
- QueryParams:
318318
- **url** (str): STAC Item URL. **Required**
319319
- **assets** (array[str]): asset names. Default to all available assets.
320-
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1,2,3`).
320+
- **asset_bidx** (array[str]): Per asset band math expression (e.g `Asset1|1;2;3`).
321321
- **asset_expression** (array[str]): Per asset band math expression (e.g `Asset1|b1\*b2`).
322322
- **max_size** (int): Max image size from which to calculate statistics, default is 1024.
323323
- **height** (int): Force image height from which to calculate statistics.

src/titiler/application/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
long_description = f.read()
77

88
inst_reqs = [
9-
"rio-cogeo>=3.0,<4.0",
9+
"rio-cogeo>=3.1,<4.0",
1010
"titiler.core>=0.4,<0.5",
1111
"titiler.mosaic>=0.4,<0.5",
1212
"starlette-cramjam>=0.1.0,<0.2",

src/titiler/core/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
long_description = f.read()
77

88
inst_reqs = [
9-
"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",
9+
"fastapi>=0.73.0",
1010
"geojson-pydantic",
1111
"jinja2>=2.11.2,<4.0.0",
1212
"numpy",
1313
"pydantic",
1414
"rasterio",
15-
"rio-tiler>=3.0,<3.1",
15+
"rio-tiler>=3.1,<3.2",
1616
"simplejson",
1717
"importlib_resources>=1.1.0;python_version<'3.9'",
1818
"typing_extensions;python_version<'3.8'",

src/titiler/core/tests/test_dependencies.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ def _expre(params=Depends(dependencies.ExpressionParams)):
120120
response = client.get("/second?bidx=1&bidx=2")
121121
assert response.json()["indexes"] == [1, 2]
122122

123-
response = client.get("/second?expression=1,2")
124-
assert response.json()["expression"] == "1,2"
123+
response = client.get("/second", params={"expression": "1;2"})
124+
assert response.json()["expression"] == "1;2"
125125

126126
response = client.get("/second")
127127
assert not response.json()["expression"]
128128
assert not response.json()["indexes"]
129129

130-
response = client.get("/third?expression=1,2")
131-
assert response.json() == "1,2"
130+
response = client.get("/third", params={"expression": "1;2"})
131+
assert response.json() == "1;2"
132132

133133
response = client.get("/third")
134134
assert not response.json()
@@ -233,17 +233,17 @@ def _bands_expr_opt(params=Depends(dependencies.BandsExprParamsOptional)):
233233
response = client.get("/second?bands=b1&bands=b2")
234234
assert response.json()["bands"] == ["b1", "b2"]
235235

236-
response = client.get("/second?expression=b1,b2")
237-
assert response.json()["expression"] == "b1,b2"
236+
response = client.get("/second", params={"expression": "b1;b2"})
237+
assert response.json()["expression"] == "b1;b2"
238238

239239
with pytest.raises(errors.MissingBands):
240240
response = client.get("/second")
241241

242242
response = client.get("/third?bands=b1&bands=b2")
243243
assert response.json()["bands"] == ["b1", "b2"]
244244

245-
response = client.get("/third?expression=b1,b2")
246-
assert response.json()["expression"] == "b1,b2"
245+
response = client.get("/third", params={"expression": "b1;b2"})
246+
assert response.json()["expression"] == "b1;b2"
247247

248248
response = client.get("/third")
249249
assert not response.json()["bands"]

src/titiler/core/tests/test_factories.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ def test_TilerFactory():
9393
assert meta["height"] == 256
9494

9595
response = client.get(
96-
f"/tiles/8/87/48.tif?url={DATA_DIR}/cog.tif&expression=b1,b1,b1&return_mask=false"
96+
"/tiles/8/87/48.tif",
97+
params={
98+
"url": f"{DATA_DIR}/cog.tif",
99+
"expression": "b1;b1;b1",
100+
"return_mask": False,
101+
},
97102
)
98103
assert response.status_code == 200
99104
assert response.headers["content-type"] == "image/tiff; application=geotiff"
@@ -648,7 +653,12 @@ def test_MultiBaseTilerFactory(rio):
648653
assert meta["count"] == 2
649654

650655
response = client.get(
651-
f"/preview.tif?url={DATA_DIR}/item.json&expression=B01,B01,B01&return_mask=false"
656+
"/preview.tif",
657+
params={
658+
"url": f"{DATA_DIR}/item.json",
659+
"expression": "B01;B01;B01",
660+
"return_mask": False,
661+
},
652662
)
653663
assert response.status_code == 200
654664
assert response.headers["content-type"] == "image/tiff; application=geotiff"
@@ -666,7 +676,13 @@ def test_MultiBaseTilerFactory(rio):
666676
assert meta["count"] == 3
667677

668678
response = client.get(
669-
f"/preview.tif?url={DATA_DIR}/item.json&assets=B01&asset_expression=B01|b1,b1,b1&return_mask=false"
679+
"/preview.tif",
680+
params={
681+
"url": f"{DATA_DIR}/item.json",
682+
"assets": "B01",
683+
"asset_expression": "B01|b1;b1;b1",
684+
"return_mask": False,
685+
},
670686
)
671687
assert response.status_code == 200
672688
assert response.headers["content-type"] == "image/tiff; application=geotiff"
@@ -896,7 +912,12 @@ def test_MultiBandTilerFactory():
896912
assert meta["count"] == 3
897913

898914
response = client.get(
899-
f"/preview.tif?directory={DATA_DIR}&expression=B01,B09,B01&return_mask=false"
915+
"/preview.tif",
916+
params={
917+
"directory": DATA_DIR,
918+
"expression": "B01;B09;B01",
919+
"return_mask": False,
920+
},
900921
)
901922
assert response.status_code == 200
902923
assert response.headers["content-type"] == "image/tiff; application=geotiff"

src/titiler/core/titiler/core/dependencies.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ class ExpressionParams(DefaultDependency):
118118
examples={
119119
"simple": {"description": "Simple band math.", "value": "b1/b2"},
120120
"multi-bands": {
121-
"description": "Coma (,) delimited expressions (band1: b1/b2, band2: b2+b3).",
122-
"value": "b1/b2,b2+b3",
121+
"description": "Semicolon (;) delimited expressions (band1: b1/b2, band2: b2+b3).",
122+
"value": "b1/b2;b2+b3",
123123
},
124124
},
125125
)
@@ -193,11 +193,11 @@ class AssetsBidxExprParams(DefaultDependency):
193193
examples={
194194
"one-asset": {
195195
"description": "Return indexes 1,2,3 of asset `data`.",
196-
"value": ["data|1,2,3"],
196+
"value": ["data|1;2;3"],
197197
},
198198
"multi-assets": {
199199
"description": "Return indexes 1,2,3 of asset `data` and indexes 1 of asset `cog`",
200-
"value": ["data|1,2,3", "cog|1"],
200+
"value": ["data|1;2;3", "cog|1"],
201201
},
202202
},
203203
)
@@ -249,11 +249,11 @@ class AssetsBidxParams(AssetsParams):
249249
examples={
250250
"one-asset": {
251251
"description": "Return indexes 1,2,3 of asset `data`.",
252-
"value": ["data|1,2,3"],
252+
"value": ["data|1;2;3"],
253253
},
254254
"multi-assets": {
255255
"description": "Return indexes 1,2,3 of asset `data` and indexes 1 of asset `cog`",
256-
"value": ["data|1,2,3", "cog|1"],
256+
"value": ["data|1;2;3", "cog|1"],
257257
},
258258
},
259259
)

src/titiler/mosaic/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
with open("README.md") as f:
66
long_description = f.read()
77

8-
inst_reqs = ["titiler.core>=0.4,<0.5", "cogeo-mosaic>=4.0,<4.1"]
8+
inst_reqs = ["titiler.core>=0.4,<0.5", "cogeo-mosaic>=4.1,<4.2"]
99
extra_reqs = {
1010
"test": ["pytest", "pytest-cov", "pytest-asyncio", "requests"],
1111
}

0 commit comments

Comments
 (0)