Skip to main content

STAC source

STACLoader

STACLoader handles static catalog traversal and API Item Search, returning metadata and asset links while leaving the selected file to its native format loader.

Catalog discovery

Find the asset before opening the bytes.

STAC narrows a dataset by space, time, collection, and links. Once an asset is selected, its native loaders.gl source can handle the actual data.

01

Catalog or API

collections · search

spacetime

02

STAC item

one spatiotemporal record

extentcontext

03

Asset link

role · media type · URL

chooseinspect

04

Native loader

Parquet · GeoTIFF · Zarr

decodescan

STAC describes where the data is and what it means; the format loader remains responsible for decoding it.

Discovery before decoding

Search the catalog. Select the asset. Load it natively.

The source keeps catalog traversal and asset selection separate from parsing. That lets a single discovery workflow lead to GeoTIFF, Parquet, Zarr, or another specialized loader.

Mode

Static linked catalog or STAC API

Search

Collections, bbox, time, and pagination

Traverse

Bounded child and asset discovery

Return

Items, collections, and role-filtered assets

The STACLoader creates a lightweight source for static STAC catalogs and STAC APIs.

import {createDataSource} from '@loaders.gl/core';
import {STACLoader} from '@loaders.gl/ogc/stac';

const source = await createDataSource('https://example.com/stac', STACLoader);

For synchronous createDataSourceSync(), import the runtime-bearing subpath:

import {createDataSourceSync} from '@loaders.gl/core';
import {STACLoader} from '@loaders.gl/ogc/stac-loader';

const source = createDataSourceSync('https://example.com/stac', STACLoader);

Detailed guide

STAC source methods

The sections below cover construction, metadata, collections, search, traversal, pagination, and asset selection.

PropertyValue
Data sourceSTACSource

Methods​

getMetadata(options?)​

Returns the root Catalog or Collection, declared conformance classes, and the detected mode:

  • api when the root exposes Item Search or API conformance declarations.
  • static for a linked catalog of JSON documents.

The root document is fetched once and cached.

getCollections(options?)​

Returns Collections. For a STAC API it follows the Collections endpoint and next links. For a static catalog it follows only child links and never downloads Items.

Options are signal, maxDepth, and maxRequests.

search(query?)​

Runs server-side STAC API Item Search and follows next links. Both GET and POST pagination links are supported, including the STAC body and merge fields.

Supported core query properties are:

  • ids
  • collections
  • bbox
  • datetime
  • limit
  • signal

search() throws for a static catalog. This prevents a seemingly small query from silently crawling a very large linked catalog.

traverse(options?)​

Explicitly traverses child and item links in a static catalog. URLs are cycle-protected and bounded by maxDepth and maxRequests. The core ids, collections, bbox, and datetime constraints are evaluated locally before Items are yielded.

getAssets(item, selection?)​

Returns assets with URLs resolved against the Item document. Assets can be selected by roles and exact mediaTypes.

Options​

For shared loading controls and parser configuration, see Source options. The settings below are specific to this source.

OptionTypeDefaultDescription
stac.maxDepthnumber32Default maximum static child-catalog depth.
stac.maxRequestsnumber1000Default maximum documents fetched by one static traversal.

Capabilities​

STACSource.capabilities implements the protocol-neutral CatalogSource capability contract from @loaders.gl/core/loader-utils. STAC-specific methods remain available directly on STACSource.

The initial implementation does not advertise text search or CQL2. Those extensions can be added without changing the shared catalog contract.