Skip to content

Commit bd71de5

Browse files
committed
update for v2.5.3
1 parent 6c013f0 commit bd71de5

File tree

3 files changed

+15
-35
lines changed

3 files changed

+15
-35
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Changed
1111

12-
- Upgraded stac-fastapi libraries to v2.5.2 from v2.4.9 [#172](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/172)
12+
- Upgraded stac-fastapi libraries to v2.5.3 from v2.4.9 [#172](https://github.com/stac-utils/stac-fastapi-elasticsearch/pull/172)
1313

1414
## [v2.2.0]
1515

stac_fastapi/core/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"attrs",
1111
"pydantic[dotenv]<2",
1212
"stac_pydantic==2.0.*",
13-
"stac-fastapi.types==2.5.2",
14-
"stac-fastapi.api==2.5.2",
15-
"stac-fastapi.extensions==2.5.2",
13+
"stac-fastapi.types==2.5.3",
14+
"stac-fastapi.api==2.5.3",
15+
"stac-fastapi.extensions==2.5.3",
1616
"pystac[validation]",
1717
"orjson",
1818
"overrides",

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Item crud client."""
2-
import json
1+
"""Core client."""
32
import logging
43
import re
54
from datetime import datetime as datetime_type
@@ -16,7 +15,7 @@
1615
from pygeofilter.backends.cql2_json import to_cql2
1716
from pygeofilter.parsers.cql2_text import parse as parse_cql2_text
1817
from stac_pydantic.links import Relations
19-
from stac_pydantic.shared import MimeTypes
18+
from stac_pydantic.shared import BBox, MimeTypes
2019
from stac_pydantic.version import STAC_VERSION
2120

2221
from stac_fastapi.core.base_database_logic import BaseDatabaseLogic
@@ -246,8 +245,8 @@ async def get_collection(self, collection_id: str, **kwargs) -> Collection:
246245
async def item_collection(
247246
self,
248247
collection_id: str,
249-
bbox: Optional[List[NumType]] = None,
250-
datetime: Union[str, datetime_type, None] = None,
248+
bbox: Optional[BBox] = None,
249+
datetime: Optional[DateTimeType] = None,
251250
limit: int = 10,
252251
token: str = None,
253252
**kwargs,
@@ -256,8 +255,8 @@ async def item_collection(
256255
257256
Args:
258257
collection_id (str): The identifier of the collection to read items from.
259-
bbox (Optional[List[NumType]]): The bounding box to filter items by.
260-
datetime (Union[str, datetime_type, None]): The datetime range to filter items by.
258+
bbox (OOptional[BBox]): The bounding box to filter items by.
259+
datetime (Optional[DateTimeType]): The datetime range to filter items by.
261260
limit (int): The maximum number of items to return. The default value is 10.
262261
token (str): A token used for pagination.
263262
request (Request): The incoming request.
@@ -413,8 +412,8 @@ async def get_search(
413412
request: Request,
414413
collections: Optional[List[str]] = None,
415414
ids: Optional[List[str]] = None,
416-
bbox: Optional[List[NumType]] = None,
417-
datetime: Optional[Union[str, datetime_type]] = None,
415+
bbox: Optional[BBox] = None,
416+
datetime: Optional[DateTimeType] = None,
418417
limit: Optional[int] = 10,
419418
query: Optional[str] = None,
420419
token: Optional[str] = None,
@@ -430,8 +429,8 @@ async def get_search(
430429
Args:
431430
collections (Optional[List[str]]): List of collection IDs to search in.
432431
ids (Optional[List[str]]): List of item IDs to search for.
433-
bbox (Optional[List[NumType]]): Bounding box to search in.
434-
datetime (Optional[Union[str, datetime_type]]): Filter items based on the datetime field.
432+
bbox (Optional[BBox]): Bounding box to search in.
433+
datetime (Optional[DateTimeType]): Filter items based on the datetime field.
435434
limit (Optional[int]): Maximum number of results to return.
436435
query (Optional[str]): Query string to filter the results.
437436
token (Optional[str]): Access token to use when searching the catalog.
@@ -466,27 +465,8 @@ async def get_search(
466465
if datetime:
467466
base_args["datetime"] = datetime
468467

469-
# As of stac-fastapi 2.5.x, the intersects GET request parameter is being sent as a list
470468
if intersects:
471-
intersects_dict = {"type": None, "coordinates": None}
472-
473-
combined_json_string = intersects[0]
474-
475-
# Iterate over the remaining fragments and add each with a preceding comma
476-
for fragment in intersects[1:]:
477-
combined_json_string += "," + fragment
478-
479-
combined_json_string = combined_json_string.replace("'", "")
480-
combined_json_string = "".join(
481-
char for char in combined_json_string if char.isprintable()
482-
)
483-
484-
try:
485-
intersects_dict = json.loads(combined_json_string)
486-
except json.JSONDecodeError as error:
487-
print("Failed to parse JSON:", error)
488-
489-
base_args["intersects"] = intersects_dict
469+
base_args["intersects"] = orjson.loads(unquote_plus(intersects))
490470

491471
if sortby:
492472
sort_param = []

0 commit comments

Comments
 (0)