-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: STAC Render Extension support (#1038)
* Render Extension Render extension started during STAC render sprint in SatSummit Lisbon 2024. - listing (or showing to please Vincent) Please contribute to complete the feature to - generate the final XYZ link for rendering following the rules in STAC extensions - add a dedicated endpoint for render XYZ * feat(stac): add render extenstions support * remove unnecessary item.json file * Rework the response structure to include links. * rename renderExtension -> stacRenderExtension * add tests for stacRenderExtension * add test for extra param * docs and docstrings * fix typing in python 3.8 * Move out query params validation * edits * update changelog --------- Co-authored-by: Emmanuel Mathot <[email protected]> Co-authored-by: vincentsarago <[email protected]>
- Loading branch information
1 parent
5158f9d
commit 72a8df9
Showing
10 changed files
with
712 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""test /COG endpoints.""" | ||
"""test /stac endpoints.""" | ||
|
||
from typing import Dict | ||
from unittest.mock import patch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"""Test utils.""" | ||
|
||
from titiler.core.dependencies import BidxParams | ||
from titiler.core.utils import deserialize_query_params, get_dependency_query_params | ||
|
||
|
||
def test_get_dependency_params(): | ||
"""Test dependency filtering from query params.""" | ||
|
||
# invalid | ||
values, err = get_dependency_query_params( | ||
dependency=BidxParams, params={"bidx": ["invalid type"]} | ||
) | ||
assert values == {} | ||
assert err | ||
assert err == [ | ||
{ | ||
"input": "invalid type", | ||
"loc": ( | ||
"query", | ||
"bidx", | ||
0, | ||
), | ||
"msg": "Input should be a valid integer, unable to parse string as an integer", | ||
"type": "int_parsing", | ||
}, | ||
] | ||
|
||
# not in dep | ||
values, err = get_dependency_query_params( | ||
dependency=BidxParams, params={"not_in_dep": "no error, no value"} | ||
) | ||
assert values == {"indexes": None} | ||
assert not err | ||
|
||
# valid | ||
values, err = get_dependency_query_params( | ||
dependency=BidxParams, params={"bidx": [1, 2, 3]} | ||
) | ||
assert values == {"indexes": [1, 2, 3]} | ||
assert not err | ||
|
||
# valid and not in dep | ||
values, err = get_dependency_query_params( | ||
dependency=BidxParams, | ||
params={"bidx": [1, 2, 3], "other param": "to be filtered out"}, | ||
) | ||
assert values == {"indexes": [1, 2, 3]} | ||
assert not err | ||
|
||
|
||
def test_deserialize_query_params(): | ||
"""Test deserialize_query_params.""" | ||
# invalid | ||
res, err = deserialize_query_params( | ||
dependency=BidxParams, params={"bidx": ["invalid type"]} | ||
) | ||
print(res) | ||
assert res == BidxParams(indexes=None) | ||
assert err | ||
|
||
# valid | ||
res, err = deserialize_query_params( | ||
dependency=BidxParams, params={"not_in_dep": "no error, no value", "bidx": [1]} | ||
) | ||
assert res == BidxParams(indexes=[1]) | ||
assert not err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.