Originally wanted a single DataPipe that would produce a list of pystac.Item objects from either ItemSearch or ItemCollection. However, pystac_client.ItemSearch uses .items() (a callable) while pystac.ItemCollection uses .items (not callable), and would necessitate some messy if-then/try-except statements. Hence why the list_pystac_items_by_search functional name, because there might be a list_pystac_items_by_collection for the pystac.ItemCollection.items in the future (if needed).
An iterable-style DataPipe to list STAC Items matching a STAC API search query! Calls
pystac_client.ItemSearch.items()
to yieldpystac.Item
instances.Preview at https://zen3geo--111.org.readthedocs.build/en/111/api.html#zen3geo.datapipes.PySTACAPIItemLister
Usage:
TODO:
Notes:
Why not just use something like:
? The issue is that FlatMapper doesn't implement the
__len__
function (see https://github.com/pytorch/data/blob/v0.6.1/torchdata/datapipes/iter/transform/callable.py#L163-L164), which would break some downstream DataPipes that rely on having a proper__len__
.pystac.Item
objects from eitherItemSearch
orItemCollection
. However,pystac_client.ItemSearch
uses.items()
(a callable) whilepystac.ItemCollection
uses.items
(not callable), and would necessitate some messy if-then/try-except statements. Hence why thelist_pystac_items_by_search
functional name, because there might be alist_pystac_items_by_collection
for thepystac.ItemCollection.items
in the future (if needed).Part of https://github.com/weiji14/zen3geo/discussions/48. Extends #59.