Skip to content

Commit 26cd5f3

Browse files
committed
Add bbox and datetime to PgStac item_collection
Used the same base_args -> clean from the search routes Probably not necessary in this situation but thought I'd keep it similar (and extensible).
1 parent de9d18b commit 26cd5f3

File tree

1 file changed

+16
-1
lines changed
  • stac_fastapi/pgstac/stac_fastapi/pgstac

1 file changed

+16
-1
lines changed

stac_fastapi/pgstac/stac_fastapi/pgstac/core.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ async def _get_base_item(collection_id: str) -> Dict[str, Any]:
248248
async def item_collection(
249249
self,
250250
collection_id: str,
251+
bbox: Optional[List[NumType]] = None,
252+
datetime: Optional[Union[str, datetime]] = None,
251253
limit: Optional[int] = None,
252254
token: str = None,
253255
**kwargs,
@@ -267,8 +269,21 @@ async def item_collection(
267269
# If collection does not exist, NotFoundError wil be raised
268270
await self.get_collection(collection_id, **kwargs)
269271

272+
base_args = {
273+
"collections": [collection_id],
274+
"bbox": bbox,
275+
"datetime": datetime,
276+
"limit": limit,
277+
"token": token,
278+
}
279+
280+
clean = {}
281+
for k, v in base_args.items():
282+
if v is not None and v != []:
283+
clean[k] = v
284+
270285
req = self.post_request_model(
271-
collections=[collection_id], limit=limit, token=token
286+
**clean,
272287
)
273288
item_collection = await self._search_base(req, **kwargs)
274289
links = await CollectionLinks(

0 commit comments

Comments
 (0)