The developers of the pystac-client library provide multiple examples for interacting with
STAC API. Please refer to those and consult the pystac-client documentation for additional information.
# Import the library neededimportpystac_client# Link to ccmeo datacube stac-apistac_root="https://datacube.services.geo.ca/stac/api"# Initialize the STAC clientcatalog=pystac_client.Client.open(stac_root)# Get the list of available collection idforcollectionincatalog.get_collections():print(collection.id)
# Import the library neededimportpystac_client# Link to ccmeo datacube stac-apistac_root="https://datacube.services.geo.ca/stac/api"# Initialize the STAC clientcatalog=pystac_client.Client.open(stac_root)# Define search parameters# In this example, we filter on the mosaic collection of HRDEM tilescollections=['hrdem-mosaic-2m']# We define a bounding box extentextent=[-79.28229773059192,44.31501485755303,-79.1702187573089,44.3929540402247]# Build the search query with the filtering parameterssearch=catalog.search(collections=collections,bbox=extent)# Use the pagination to improve efficiencylinks=[]# Iterate over each returned page and get the dtm COG linkforpageinsearch.pages():foriteminpage:links.append(item.assets['dtm'].href)