# STACIT - Spatio-Temporal Asset Catalog Items

Added in version 3.4.

Driver short name

STACIT

Driver built-in by default

This driver is built-in by default

This driver supports opening STAC API ItemCollections, with the input usually being a STAC API search query or the results saved as a JSON file. Items in the response must include projection information following the Projection Extension Specification. It builds a virtual mosaic from the items.

A STACIT dataset which has no subdatasets is actually a VRT -- GDAL Virtual Format dataset. Thus, translating it into VRT will result in a VRT file that directly references the items.

Note that STAC API ItemCollections are not the same as STAC Collections. STAC API ItemCollections are GeoJSON FeatureCollections enhanced with STAC entities.

## Open syntax

STACIT datasets/subdatasets can be accessed with one of the following syntaxes:

- `filename.json`: local file

- `STACIT:"https://example.com/filename.json"`: remote file or query

- `STACIT:"filename.json":asset=my_asset`: specify the name of the asset GDAL should read (i.e. "visual")

- `STACIT:"filename.json":collection=my_collect,asset=my_asset`: limit to items in a given collection and specify asset to read

- `STACIT:"filename.json":collection=my_collect,asset=my_asset,crs=my_crs`: specify a collection, asset, and limit to items in a given CRS

Starting with GDAL 3.10, specifying the `-if STACIT` option to command line utilities accepting it, or `STACIT` as the only value of the `papszAllowedDrivers` of `GDALOpenEx()`, also forces the driver to recognize the passed filename or URL.

## Open options

Open options can be specified in command-line tools using the syntax `-oo <NAME>=<VALUE>` or by providing the appropriate arguments to `GDALOpenEx()` (C) or `gdal.OpenEx` (Python). The following open options are supported:

- MAX_ITEMS=<integer>: Defaults to `1000`. Maximum number of items fetched. 0=unlimited.

- COLLECTION=value: Name of collection to filter items.

- CRS=value: Name of CRS to filter items.

- ASSET=value: Name of asset to read.

- RESOLUTION=[AVERAGE​/​HIGHEST​/​LOWEST]: Defaults to `AVERAGE`. Strategy to use to determine dataset resolution.

- OVERLAP_STRATEGY=[REMOVE_IF_NO_NODATA​/​USE_ALL​/​USE_MOST_RECENT]: (GDAL >= 3.9.1) Defaults to `REMOVE_IF_NO_NODATA`. Strategy to use when the ItemCollections contains overlapping items, and that some items are fully covered by other items that are more recent.

  Starting with GDAL 3.9.1, the `REMOVE_IF_NO_NODATA` strategy is applied by default. The STACIT virtual mosaic will omit fully covered items, only if no band declares a nodata value. (Note that the determination whether a band has a nodata value of not is done by opening one of the items, and assuming it is representative of the characteristics of the others in the collection).

  This strategy can be forced in all cases by selecting the `USE_MOST_RECENT` strategy (this was the strategy applied prior to 3.9.1)

  The `USE_ALL` strategy always causes all items to be listed in the virtual mosaic, with the most recent ones being rendered on top of the less recent ones.

## Subdatasets

If a STACIT JSON file contains several collections, assets or CRS, the driver will return a list of subdataset names to open each of the possible subdatasets.

## Driver capabilities

Supports VirtualIO

This driver supports virtual I/O operations (/vsimem/, etc.)

## Examples

List the subdatasets associated to a STAC search on a given collection, bbox and starting from a datetime:

Bash

    gdalinfo "STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\""
    # from GDAL 3.11+
    gdal raster info "STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\""

PowerShell

    gdalinfo 'STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\"'
    # from GDAL 3.11+
    gdal raster info 'STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\"'

Python

    from osgeo import gdal

    gdal.UseExceptions()

    stac_url = "https://planetarycomputer.microsoft.com/api/stac/v1/search"
    bbox = "-100,40,-99,41"
    datetime = "2019-01-01T00:00:00Z%2F.."
    collections = "naip"
    url = f"{stac_url}?collections={collections}&bbox={bbox}&datetime={datetime}"

    ds = gdal.OpenEx(
        url, allowed_drivers=["STACIT"]
    )  # force the STACIT driver or it opens as GeoJSON

    print(gdal.Info(ds, format="json"))

Open a subdataset returned by the above request:

Bash

    gdalinfo "STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\":asset=image"
    # from GDAL 3.11+
    gdal raster info "STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\":asset=image"

PowerShell

    gdalinfo 'STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\":asset=image'
    # from GDAL 3.11+
    gdal raster info 'STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\":asset=image'

Python

    subdatasets = ds.GetSubDatasets()
    # get the first subdataset properties
    sds_properties = subdatasets[0]
    subdataset_url = sds_properties[0]  # a tuple of URL and description
    subdataset = gdal.OpenEx(subdataset_url, allowed_drivers=["STACIT"])

    print(gdal.Info(subdataset, format="json"))

## See Also

- STACTA - Spatio-Temporal Asset Catalog Tiled Assets documentation page.