SpatioTemporal Asset Catalogue (STAC)
SpatioTemporal Asset Catalog (STAC) is a specification that provides a common language to describe geospatial information so it can more easily be indexed and discovered.
DEA’s STAC metadata can be used to quickly identify all available data for a given product, location or time period. Using this metadata, the corresponding satellite product data can be efficiently downloaded from the cloud onto a local disk programmatically, or streamed directly into desktop GIS software like QGIS.
This tutorial is based on the odc-stac library, which simplifies using the STAC API with the ODC data model. For further information on how to use odc-stac, have a look at the developer guide.
[1]:
!pip install pystac-client
!pip install odc-stac
[2]:
import pystac_client
import odc.stac
[3]:
catalog = pystac_client.Client.open('https://explorer.dea.ga.gov.au/stac')
[4]:
# Set a bounding box
# [xmin, ymin, xmax, ymax] in latitude and longitude
bbox = [149.05, -35.32, 149.17, -35.25]
# Set a start and end date
start_date = "2021-12-10"
end_date = "2021-12-21"
# Set the STAC collections
collections = ["ga_ls8c_ard_3"]
[5]:
# Build a query with the set parameters
query = catalog.search(
bbox=bbox, collections=collections, datetime=f"{start_date}/{end_date}"
)
# Search the STAC catalog for all items matching the query
items = list(query.get_items())
print(f"Found: {len(items):d} datasets")
Found: 4 datasets
[6]:
crs = "EPSG:32655"
resolution = 30
ds = odc.stac.load(
items,
bands=("nbart_red"),
crs=crs,
resolution=resolution,
chunks={},
groupby="solar_day",
bbox=bbox,
)
[7]:
# odc-stac library downloads DEA datasets stored in AWS
# when external to AWS (like outside DEA sandbox), AWS signed requests must be disabled
import os
os.environ['AWS_NO_SIGN_REQUEST'] = 'YES'
[8]:
ds.nbart_red.plot(col='time');
![../../../../_images/guides_setup_gis_stac_8_0.png](../../../../_images/guides_setup_gis_stac_8_0.png)
For a more in-depth guide to using STAC without the odc-stac library, see the user guide on downloading and streaming data using STAC.