-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Description
First, initializing the client and creating the search over the Copernicus product catalogue:
from pystac_client import Client
catalog = Client.open("https://catalogue.dataspace.copernicus.eu/stac")
search = catalog.search(
collections = ['SENTINEL-2'],
)The following code doesn't automatically paginate:
for item in search.items():
print(item)However, the following code does automatically paginate:
from pystac import Item
url = search.url_with_parameters()
while True:
async with session.get(url) as response:
page = await response.json()
if 'features' in page:
# https://github.com/stac-utils/pystac-client/blob/1a1a2d65c736dc95fb0e16b21795a968100b00c6/pystac_client/item_search.py#L692-L694
for item in page['features']:
print(Item.from_dict(item, root=catalog, preserve_dict=False))
# https://github.com/stac-utils/pystac-client/blob/1a1a2d65c736dc95fb0e16b21795a968100b00c6/pystac_client/stac_api_io.py#L310-L312
if 'links' not in page:
break
for link in page['links']:
if link['rel'] == 'next':
url = link['href']
break
else:
breakgadomski
Metadata
Metadata
Assignees
Labels
No labels