--- name: stac-catalog-validation description: "Validate STAC Items, Catalogs, and Collections offline across 1.0.0 and 1.1.0 schemas, temporal rules, geometry/bbox bounds, collection links, local assets, and extensions." category: data risk: safe source: self source_type: self date_added: "2026-12-01" author: Koushik-Katkam tags: [stac, geospatial, metadata, json-schema, validation, earth-observation] --- # STAC Catalog Validation ## Overview Run a version-aware, offline-capable validation workflow for SpatioTemporal Asset Catalog (**STAC**) `Catalog`, `Collection`, and `Item` JSON documents (`1.0.0` and `1.1.0`). The workflow separates **specification violations**, **cross-entity consistency findings**, **partial extension checks**, and **unverified remote resources** so static catalogs and metadata pipelines fail deterministically on broken temporal or spatial invariants without treating unprobed URLs, unpinned schemas, or unsupported versions as valid. Distinction from related geospatial skills: - `geospatial-python` (merged via PR #2656) covers vector CRS reprojection (`set_crs` vs `to_crs`), geometry repair (`shapely.make_valid`), and raster sampling with GeoPandas/Shapely/Rasterio. - `noaa-radar-satellite-fetching` retrieves raw NOAA NEXRAD and GOES objects from AWS S3 buckets and filters scan timestamps. - `radar-satellite-analysis` interprets decoded meteorological radar/satellite observations (beam geometry, parallax, calibration, quality flags). - `xarray-coordinate-alignment` aligns multi-dimensional labeled scientific arrays (`xr.align`, `xr.merge`). This skill validates the **STAC metadata graph and contracts** wrapping geospatial assets before downstream array loading or catalog indexing. ## When to Use - Publishing or auditing a static STAC `Catalog` / `Collection` / `Item` tree or STAC API item payload (versions `1.0.0` or `1.1.0`). - Catching common STAC defects before ingestion: malformed JSON, `properties: null`, invalid GeoJSON geometry types or shapes, `datetime: null` missing `start_datetime`/`end_datetime`, `bbox` supplied with `geometry: null`, Item bounds spilling outside declared `bbox` or parent Collection spatial/temporal extents, or broken local `links` and `assets` paths. - Verifying offline STAC trees while explicitly reporting remote assets, unknown URI schemes, and unpinned extension schemas as unverified. - Do **not** use this skill for CRS coordinate transformations (`geospatial-python`), array coordinate alignment (`xarray-coordinate-alignment`), or downloading satellite granules (`noaa-radar-satellite-fetching`). ## Prerequisites - Python 3.10+ with `jsonschema` (tested with Python 3.12.10, `jsonschema 4.26.0`, `pytest 9.1.1`). - Local STAC JSON files (`Catalog`, `Collection`, `Item`) and, for full schema conformance, official version-pinned local STAC + GeoJSON + extension JSON Schemas resolved via a local `referencing.Registry`. Without external schema clones, the bundled harness runs **partial offline subset validation** and explicitly labels what external schemas were not verified. - **Zero network / credential requirement:** No paid services, satellite downloads, STAC API write calls, or cloud storage credentials are required. Remote asset `href`s (`https://`, `s3://`, `gs://`), unknown URI schemes, and unpinned extension schemas are reported under unverified remote resources unless resolved in an authorized environment. ## How It Works ### 1. Pin STAC version and distinguish full vs. subset schemas 1. Parse JSON safely and verify the root document is a JSON object (`dict`). Return structured specification findings on malformed JSON, non-object documents, or `null` structural fields (`properties: null`, `links: null`, `assets: null`) rather than crashing. 2. Inspect `stac_version` and `type` (`"Catalog"`, `"Collection"`, `"Feature"`). Treat unrecognized `stac_version` values as **unverified** rather than substituting a `1.0.0` or `1.1.0` schema. 3. Note version-specific rules documented in [version and extension rules](references/stac-version-and-extensions.md): - In STAC `1.1.0`, `bbox` is **prohibited** when `geometry` is `null`; in `1.0.0`, omitting `bbox` when `geometry` is `null` is recommended. - Common Asset Metadata (`bands`, `data_type`, `nodata`, `statistics`) moved into STAC `1.1.0` core, whereas `1.0.0` relies on `eo` / `raster` extensions (`eo:bands`, `raster:bands`). - Projection extension `v2.0.0` replaces deprecated `proj:epsg` with `proj:code` (e.g. `"EPSG:32610"`). 4. Load official local JSON Schemas via `referencing.Registry` when full schema compliance is required. If running only the self-contained subset rules from [stac validation harness](references/stac-validation-harness.md), record extension checks explicitly as **partial checks** (`partial_checks`) and unpinned schemas as **unverified**. ### 2. Run layered checks and classify findings cleanly Evaluate every document and local catalog graph across four layers, keeping the output categories strictly separate: 1. **Specification violations** (`spec_violations` — core schema & invariant failures): - Malformed JSON, non-object roots, invalid field types (`properties: null`, `links: null`, `assets: null`), or subset schema violations. - Unsupported or prohibited GeoJSON `geometry.type` (`Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon` only; `GeometryCollection` is prohibited by STAC `1.0.0` and `1.1.0` Item specs) or malformed coordinate arrays (unclosed polygon rings, wrong dimensionality, `bool` values). - `properties.datetime` is `null` while either `properties.start_datetime` or `properties.end_datetime` is missing or `null`; unparseable or calendar-invalid RFC 3339 timestamps (`2026-02-30`); `start_datetime > end_datetime`; or invalid/non-2-item/inverted Collection or linked parent Collection `extent.temporal.interval` endpoints (distinguishing invalid endpoints from legitimate `null` open bounds `[null, end]`, `[start, null]`, `[null, null]`). - `geometry` is non-null while `bbox` is missing; `geometry` is `null` while `bbox` is present on a `1.1.0` Item; `bbox` has invalid length (`!= 4` and `!= 6`), `miny > maxy`, `minz > maxz` (6D), or out-of-range WGS84 coordinates. 2. **Additional consistency findings** (`consistency_findings` — structural & cross-entity checks): - Item GeoJSON geometry bounds fall outside Item `bbox` beyond tolerance (`1e-6`). - Item `collection` property disagrees with parent Collection `id`, or lacks a matching `rel: "collection"` link. - **Both** Item temporal bounds (`start_datetime`/`end_datetime` or `datetime`) fail to fall inside parent Collection `extent.temporal.interval`, or Item `bbox` falls outside parent Collection `extent.spatial.bbox` (or parent Collection extent is malformed). - Local relative or local `file://` `links` (`child`, `item`, `collection`, `parent`, `root`) or `assets..href` targets (after `unquote()` URI decoding) do not exist on disk. 3. **Partial checks & Unverified remote resources** (`partial_checks`, `unverified_remote_resources`): - `partial_checks`: identifies checks verified only via bundled field rules (for example, Projection `v2.0.0` `proj:code` shape) when official extension JSON Schemas are not loaded locally. - `unverified_remote_resources`: unsupported `stac_version`, unpinned `stac_extensions` URIs, remote `http://`/`https://`/`s3://`/`gs://`/`az://` URIs, unknown schemes (`ftp://`), non-local `file://remotehost/...` URIs, or top-level document paths / local `links` / `assets` resolving outside the approved `catalog_root`. ### 3. Verify results without overstating coverage Report exact counts for `spec_violations`, `consistency_findings`, `partial_checks`, and `unverified_remote_resources` per inspected document. Never report a partial-schema run or a run with unverified remote resources as full official specification compliance. ## Examples Run the self-contained offline STAC suite in [stac validation harness](references/stac-validation-harness.md): ```text User request: "Validate our static STAC 1.1.0 collection and items before publishing." Inputs: Local catalog directory with collection.json, item.json files, and local asset files. Expected result: Valid 1.1.0 items report 0 specification violations and 0 consistency findings while explicitly flagging remote https:// assets under unverified_remote_resources and subset Projection checks under partial_checks. Invalid fixtures catch malformed JSON, properties: null, geometry type "Bogus", datetime: null with missing end_datetime, Item intervals ending outside Collection temporal extent, Items outside Collection spatial extent, and paths escaping the catalog root. ``` ## Limitations - The bundled harness uses **offline subset schemas** rather than full official STAC/GeoJSON/extension JSON Schemas (`$ref` network resolution is deliberately disabled). Use official version-pinned local clones with `referencing.Registry` when full `$ref` schema coverage is required. - Antimeridian-crossing bboxes (`minx > maxx`, where geometry-vs-bbox containment is skipped), 3D Z-range coordinate checks across vertices, full extension schemas beyond minimal field presence, and remote or recursive graph-level link traversal remain incomplete in the offline harness and are flagged under `partial_checks` / `unverified_remote_resources` rather than treated as full conformance. - Remote COG/Parquet/Zarr header readability and GDAL pixel decoding require online authorization or `geospatial-python` / raster tooling. - Core Item `geometry` and `bbox` sanity assumes WGS84 (`EPSG:4326`), per the STAC Item specification. ## Safety and Side Effects - Strictly **read-only** over local JSON files and local asset existence checks (`Path.is_file()`). - **Trusted catalog root & top-level document containment:** Callers must pass a trusted `catalog_root` directory; `validate_stac_document` enforces the same `catalog_root` containment (`is_relative_to`) and regular-file (`is_file()`) checks on the top-level `doc_path` before reading it as it enforces on local `links` and `assets`. - **Untrusted STAC & linked metadata hardening:** Guard non-string/unhashable field types (`type: []`, `stac_extensions: [{}]`, `link.rel: ["self"]`), validate nested linked structures (`parent_collection`, `extent`, `extent.temporal`, `extent.spatial`) as JSON objects/arrays before indexing, distinguish invalid interval endpoints from legitimate `null` open bounds, catch malformed URI syntax (`ValueError` from `urlsplit`) and invalid OS path characters (`ValueError`/`OSError`), decode URI paths carefully (`unquote` / `url2pathname`), reject unknown URI schemes and remote `file://` hosts, and avoid fetching URLs discovered inside untrusted JSON. ## Sources and related skills - [STAC Specification v1.1.0 (Items, Catalogs, Collections)](https://github.com/radiantearth/stac-spec/tree/v1.1.0) - [STAC Specification v1.0.0](https://github.com/radiantearth/stac-spec/tree/v1.0.0) - Related skills: [geospatial-python](https://github.com/sickn33/agentic-awesome-skills/blob/e4dcf3977b6d1e18a2539f630bd82c2433d283e2/skills/geospatial-python/SKILL.md) (CRS & raster alignment), [noaa-radar-satellite-fetching](https://github.com/sickn33/agentic-awesome-skills/blob/e4dcf3977b6d1e18a2539f630bd82c2433d283e2/skills/noaa-radar-satellite-fetching/SKILL.md) (NOAA archive discovery), [radar-satellite-analysis](https://github.com/sickn33/agentic-awesome-skills/blob/e4dcf3977b6d1e18a2539f630bd82c2433d283e2/skills/radar-satellite-analysis/SKILL.md) (remote-sensing interpretation), [xarray-coordinate-alignment](https://github.com/sickn33/agentic-awesome-skills/blob/e4dcf3977b6d1e18a2539f630bd82c2433d283e2/skills/xarray-coordinate-alignment/SKILL.md) (coordinate alignment).