GeoStack product catalog
A product catalog records what you made, from which inputs, with which code, in a database other people and apps can search. This doc fixes its record, its write path and its backends, and keeps the database itself a deployment choice.
Summary
Products are recorded in a catalog that is a protocol, not a particular database. geocatalog owns the record and the path that writes it; which store holds it (PostGIS, pgstac, GeoParquet or another) is chosen per deployment. Nothing on the data path changes: the Icechunk repo stays the truth, and the catalog can be rebuilt from its tags.
- F.Publish to a product catalog. geocatalog reads source catalogs and can export a STAC collection, but nothing writes products into a database others can search.
publishupserts one STAC-shaped record per product of a tagged snapshot, through aProductCatalogadapter. - K.One record, three encodings. The same product appears as a GeoParquet row, a PostGIS row and a STAC item, and nothing keeps their fields aligned. The core fields are defined once and each encoding is generated from them; an ORM maps only that core, so apps can add their own columns.
- L.pgstac as a synced index. pgstac stores items dehydrated in partitioned tables, so an ORM cannot write to it. Your own PostGIS table is the catalog of record, and pgstac, when you want STAC search, is fed from it with
upsert_items.
End state. The Icechunk repo holds data and its meta/ rows; geocatalog holds the record definition, ProductCatalog, publish and one adapter per backend, each behind its own extra; your apps own the table's DDL and any extra columns; pgstac, if used, is a disposable search index; pipekit-experiment supplies the recipe stamp each record carries.
Ownership rules
The catalog is always derived: data flows down from the repo, and search flows back up to the next task.
- 1
The Icechunk repo owns the data and its
meta/rows and is the only source of truth. It never reads the catalog. - 2
geocatalog owns the record (
CORE_FIELDS), theProductCatalogprotocol,publishand the adapters. It never imports a database driver outside an adapter's extra, and never creates or alters a table. - 3
Your app owns the products table's DDL, through one migration tool, and its extra columns. It never writes the core columns except through
publish. - 4
pgstac, when used, owns STAC search. It is fed by a sync through its own functions, never by an ORM, and holds nothing that cannot be rebuilt from the table.
- 5
pipekit-experiment owns the recipe stamp each record carries (recipe registries, G). It never imports geocatalog.
How it composes: one running example
A month of matched-filter products over one site. S Sentinel-2 scenes over the site in June 2026 have each been filtered and committed into the repo s3://bkt/s2_site, on branch mf-v0.3, and the commit tagged mf-v0.3-2026-06 (L2 page, B). Each product is one group products/mf/<scene id> with one meta/ row.
Stage 1: publish the month (Icechunk → geocatalog → products table)
TL;DR. Turn every product row of the tagged snapshot into one catalog record, written so that running it twice changes nothing.
Problem. Let ρ₁, …, ρ_S be the product rows of meta/ at the tag's snapshot σ. Each record carries an id, a footprint g ⊂ ℝ² in EPSG:4326, a time interval [t₀, t₁], a location (the icechunk:// group at σ), and properties. Publishing writes one record per row and is idempotent: upserting the same set twice leaves the catalog unchanged.
import geocatalog
import geocatalog.storage
# Shapes: R rows in meta/ at the tag; S of them are products
# proposed (A)
catalog = geocatalog.open_catalog("icechunk://s3://bkt/s2_site") # → R rows
# proposed (F)
products = geocatalog.storage.PostGISCatalog(dsn, table="products")
# r_s = (id, g, [t₀, t₁], href@σ, π), s = 1 … S
# proposed (F)
published = geocatalog.storage.publish( # → S records
catalog,
products,
tag="mf-v0.3-2026-06",
collection_id="products-mf",
)
Today the closest thing is geocatalog.build.append_files, which appends rows to a GeoParquet file and knows nothing about snapshots. The payoff of F is that the record names σ, so it can never point at data that changes under it.
Stage 2: find them next month (products table → geocatalog)
TL;DR. Search the catalog for products over the site, and get back the same kind of working catalog a source search returns.
Problem. For a query with bounds B ⊂ ℝ² and interval T, keep every record whose footprint meets B and whose interval meets T, with the same rule the working catalog uses for its query.
import geocatalog.load # Shapes: K records kept; per product 1 band on its own H × W grid # keep(r) ⇔ g ∩ B ≠ ∅ ∧ [t₀, t₁] ∩ T ≠ ∅ # proposed (F) found = products.search(site_june) # → K rows # proposed (C) tree = geocatalog.load.load_scenes(found, site_june) # → K nodes
search returns a GeoCatalog, so everything downstream (load_scenes, matchup, a training dataset) works unchanged. A product made last month is found exactly like a public scene.
Stage 3: trace a map back (catalog → sources, recipe)
TL;DR. From one product, recover the scenes it came from and the code that made it.
Problem. A product α was made by recipe R from inputs x. Its record names x through derived_from links and R through its recipe stamp, so both can be followed without reading any code or folder names.
import pipekit_experiment
# Shapes: one record; N input items
# proposed (F)
record = products.get("mf-v0.3/S2A_20260601_T30SYJ")
# proposed (F)
inputs = record.links_of("derived_from") # → N items
# today* (pipekit-experiment)
recipes = pipekit_experiment.S3ModelRegistry("s3://bkt/recipes/")
# R = registry.load(h_R)
# today (pipekit-experiment)
recipe = recipes.load(record.properties["pipekit:pipeline_hash"])
The stamp is defined on the recipe registries page (G). With inputs at their snapshot and the recipe by hash, the product can be rebuilt and compared, which is that page's gate G1.
Current-state audit
No product catalog exists today; the five pieces it builds on are healthy. Read on main on 12 Nov 2026 at geotoolz 640670c.
| Symbols | Defined in | Used by | Verdict |
|---|---|---|---|
STACSource | geocatalog/_src/sources/stac.py | the source layer (_stac_item.py, gee.py, _extras.py) | Healthy. Reads any STAC API, so it reads a pgstac index back with no new code. |
to_stac_collection | geocatalog/_src/storage/stac.py:205 | no internal callers; public export | Healthy. Groups rows into items; the base publish builds on. |
append_files | _src/storage/streaming.py:838, exported from geocatalog.build | no internal callers; public export | Healthy. Appends to GeoParquet; becomes the GeoParquet adapter's upsert. |
RESERVED_COLUMNS | geocatalog/_src/_schema.py:19 | both backends, the storage writers | Healthy. filepath, start_time, end_time, geometry, bbox: almost the core K needs. |
DuckDBGeoCatalog, from_geoparquet | _src/backends/duckdb_backend.py, _src/storage/parquet.py | open_catalog, staging, vector loading | Healthy. The query engine a GeoParquet-backed catalog already has. |
Smaller findings:
- 1
No write to a catalog service. Nothing in geocatalog's
src/writes to a STAC API or a database: no pgstac, no Transactions extension, no SQLAlchemy. - 2
Two CRSs. geocatalog stores footprints in the catalog's CRS; a cross-repo catalog wants EPSG:4326 plus the native CRS as a field.
- 3
Names differ at the STAC edge.
filepathvsassets.data.href,start_timevsstart_datetime. K keeps geocatalog's names and maps them once.
Publish to a product catalog behind one protocol
geocatalog writes product records through ProductCatalog, and never through a database driver directly.
| Symbol | Destination | Reason |
|---|---|---|
ProductCatalog | geocatalog.storage | The protocol: upsert, set_collection, search, get. |
publish | geocatalog.storage | Tagged snapshot to records; builds on to_stac_collection. |
PostGISCatalog | geocatalog.storage, extra [postgis] | Uses K's ProductRecord over your table. |
PgstacCatalog, StacApiCatalog | geocatalog.storage, extra [stac] | upsert_items and search, or the Transactions extension over HTTP (L). |
GeoParquetCatalog | geocatalog.storage | stac-geoparquet files; upsert wraps append_files. No server. |
- 1
Define the protocol and the GeoParquet adapter. It needs no server, so the whole path can be tested in CI.
- 2
Write
publish. Refuse untagged snapshots, stamp each item with repo, key, snapshot and lineage, upsert by id. - 3
Add the PostGIS adapter once K's record exists, then the pgstac and STAC API adapters with L.
The refactor, as the user sees it:
# Today: # today* (geocatalog) geocatalog.build.append_files(archive, product_paths, extract_row, ...) # After: # proposed (F) geocatalog.storage.publish(catalog, products, tag=tag, collection_id=collection)
Publishing reuses the STAC export that ships today and adds the snapshot stamp, the lineage links and the upsert. The backend hides behind ProductCatalog, whose search returns a working catalog, which closes the loop. Each row's parent extra names the source item it came from.
# geocatalog/_src/storage/products.py
"""Publish a tagged Icechunk snapshot to a product catalog, whatever its backend."""
from collections.abc import Sequence
from typing import Protocol
import pystac
from geocatalog._src.backends.icechunk import IcechunkGeoCatalog
from geocatalog._src.base import GeoCatalog
from geocatalog._src.geoslice import GeoSlice
from geocatalog._src.storage.stac import to_stac_collection
# Shapes: R rows in meta/ at the tag
class ProductCatalog(Protocol):
"""Where products are recorded: one STAC-shaped record per product.
Adapters, each behind its own extra: PostGISCatalog (ProductRecord over
your own table), PgstacCatalog (upsert_items and search), StacApiCatalog
(a STAC API with Transactions) and GeoParquetCatalog (stac-geoparquet).
"""
def upsert(self, items: Sequence[pystac.Item]) -> int: ...
def set_collection(self, collection: pystac.Collection) -> None: ...
def search(self, slice_: GeoSlice) -> GeoCatalog: ...
def publish(
catalog: IcechunkGeoCatalog,
products: ProductCatalog,
*,
tag: str,
collection_id: str,
) -> int:
"""Upsert one record per meta/ row of a tagged snapshot.
Algorithm:
1. Refuse an untagged snapshot, since only a tag is safe from expiry.
2. Build the collection and its items from the rows at the tag.
3. Stamp each item with the repo, key, snapshot and derived_from links.
4. Upsert the items by id, so a rerun changes nothing.
5. Point the collection-level asset at repo@tag.
Args:
catalog: The repository's catalog.
products: The product catalog to record into, any backend.
tag: The Icechunk tag to publish.
collection_id: The product collection, e.g. "products-mf".
Returns:
The number of records upserted.
Raises:
ProductCatalogError: If the tag does not exist or the backend refuses
a write.
"""
# proposed (F)
tagged = catalog.at_tag(tag) # → R rows
# today (geocatalog)
collection = to_stac_collection( # → R items
tagged,
collection_id=collection_id,
)
# proposed (F)
stamped = stamp_items( # R → R items
collection,
uri=catalog.uri,
snapshot=tagged.snapshot,
)
# proposed (F)
upserted = products.upsert(stamped) # R → ()
# proposed (F)
tag_asset = with_tag_asset(collection, uri=catalog.uri, tag=tag)
# proposed (F)
products.set_collection(tag_asset)
return upserted
Which database, and how many
The product catalog is a protocol, not a product. Its record is STAC-shaped (geometry, time, properties, links, assets), so any store that holds a geometry and some JSON can back it. geocatalog talks to an adapter and never to a driver.
| Backend | Good for | Costs |
|---|---|---|
| PostgreSQL + PostGIS, your own table | Joins with your other tables (alerts, labels, watchlists); spatial SQL; a schema you own | You write the search API yourself |
| pgstac behind stac-fastapi | STAC search for free; STACSource reads it back with no new code | STAC's schema, and a service to run |
| GeoParquet (stac-geoparquet) | No server; DuckDB queries; lives next to the repos | No live search; a write rewrites a file |
| Other stores | A warehouse or search index your platform already runs | One more adapter to maintain |
How many: two catalogs do not need two servers. One PostgreSQL instance can hold a source family (your mirror) and a product family (products/mf, products/plumes, …) as separate collections or tables. Split them when access or lifetime differ, for example private products beside a public mirror; the derived_from links still work across them, since they are URLs.
ProductCatalog. Pick the store per deployment: GeoParquet while it is just you, PostGIS or pgstac once apps or other people need live search.Rules that keep the product catalog honest
- 1
Commit first, publish second. The product catalog never points at data that is not committed. If a publish fails, rerun it: items are upserted by id, so a rerun changes nothing.
- 2
Publish tags, not branch heads. Every item names a snapshot id, and a tag keeps that snapshot from being expired. The collection-level asset follows the latest tag.
- 3
Every product links to its sources. A
derived_fromlink per input item, plus the code that made it (processing:software), so "which scenes and which version made this map" is one lookup. - 4
Mirror sources only when you must. Query the public catalogs directly; mirror into your own catalog only the subset you need offline, behind your own credentials, or virtualized into a repo (E).
- 5
Write through the protocol, not a driver.
publishtalks to aProductCatalog; each adapter brings its own driver behind its own extra (an HTTP client for a STAC API, psycopg for PostGIS, pyarrow for GeoParquet). Running the database is deployment, beside your apps.
What one record looks like
{
"type": "Feature",
"id": "mf-v0.3/S2A_20260601_T30SYJ",
"collection": "products-mf",
"geometry": { … }, from meta/geometry
"properties": {
"datetime": "2026-06-01T11:03:21Z", from meta/start_time
"processing:software": { "geotoolz-ops": "0.12" },
"icechunk:repo": "s3://bkt/s2_site",
"icechunk:snapshot": "<snapshot id>",
"icechunk:key": "products/mf/S2A_20260601_T30SYJ"
},
"links": [
{ "rel": "derived_from",
"href": "<source catalog>/collections/sentinel-2-l2a/items/S2A_…" }
],
"assets": {
"data": {
"href": "icechunk://s3://bkt/s2_site@<snapshot id>/products/mf/S2A_…",
"roles": ["data"]
}
}
}
One record, three encodings
The core fields are defined once, and the GeoParquet schema, the SQL table and the STAC mapping are generated from them.
| Symbol | Destination | Reason |
|---|---|---|
CoreField, CORE_FIELDS | geocatalog.storage | One definition of the core, by name, Arrow type, SQL type and STAC path. |
core_table, ProductRecord | geocatalog.storage, extra [postgis] | The SQLAlchemy mapping of the core; maps a subset of the real table. |
A product record has a small core that every encoding shares. geocatalog's GeoParquet already reserves filepath, start_time, end_time, geometry and bbox, and treats every other column as an extra; that is almost the same core a PostGIS table or a STAC item needs.
| Field | geocatalog GeoParquet | PostGIS table | STAC item |
|---|---|---|---|
| identity | id extra | id, primary key | id |
| grouping | one file per collection | collection | collection |
| where | filepath | filepath | assets.data.href |
| footprint | geometry, WKB | geometry, SRID 4326, GIST index | geometry |
| time | start_time, end_time | two timestamptz | start_datetime, end_datetime |
| native CRS | file metadata | crs | proj:code |
| everything else | flat extra columns | properties JSONB, plus promoted columns | properties |
Keep geocatalog's names everywhere it owns the storage (GeoParquet and your table) and rename only at the STAC edge. They are already in a versioned on-disk schema, so renaming them would need a migration for no gain.
An ORM that maps only the core
A SQLAlchemy model reads and writes only the columns it declares. geocatalog can therefore map the core while your apps add their own columns to the same table (alert status, labels, reviewer notes) without geocatalog knowing they exist. Three conditions make that safe:
- 1
Unmapped columns are nullable or have a server default. The ORM never sends a value for them, so a
NOT NULLcolumn without a default makes every insert fail. - 2
One owner for the DDL. The full table is defined by one migration tool (Alembic in your app, say). geocatalog maps the core and never calls
create_all, which would build a table with only the core. - 3
Promote what you filter on. Fields queried often (
algo,version,cloud_cover) become real indexed columns; the rest stay in JSONB, with a GIN index for the odd ad-hoc filter.
Defining the core once, and generating both the table and the Arrow schema from it, keeps the encodings aligned by construction.
# geocatalog/_src/storage/record.py
"""The catalog record's core fields, defined once for SQL, Arrow and STAC."""
import dataclasses
import pyarrow as pa
import sqlalchemy as sa
import sqlalchemy.orm as orm
from geoalchemy2 import Geometry
from sqlalchemy.dialects.postgresql import JSONB
@dataclasses.dataclass(frozen=True)
class CoreField:
"""One core field and its type or path in each encoding.
Args:
name: The column name, in GeoParquet and in the table.
arrow: Its Arrow type in GeoParquet.
sql: Its SQL type in the table.
stac: Where it lives in a STAC item.
"""
name: str
arrow: pa.DataType
sql: sa.types.TypeEngine
stac: str
# proposed (F)
CORE_FIELDS = (
CoreField("id", pa.string(), sa.Text(), "id"),
CoreField("collection", pa.string(), sa.Text(), "collection"),
CoreField("filepath", pa.string(), sa.Text(), "assets.data.href"),
CoreField(
"geometry",
pa.binary(),
Geometry("GEOMETRY", srid=4326),
"geometry",
),
CoreField(
"start_time",
pa.timestamp("ms"),
sa.DateTime(timezone=True),
"properties.start_datetime",
),
CoreField(
"end_time",
pa.timestamp("ms"),
sa.DateTime(timezone=True),
"properties.end_datetime",
),
CoreField("crs", pa.string(), sa.Text(), "properties.proj:code"),
)
# proposed (F)
def core_table(name: str, metadata: sa.MetaData) -> sa.Table:
"""The columns geocatalog maps; the real table may hold more."""
columns = [
sa.Column(field.name, field.sql, primary_key=field.name == "id")
for field in CORE_FIELDS
]
properties = sa.Column("properties", JSONB)
return sa.Table(name, metadata, *columns, properties)
# not pinned (sqlalchemy)
class Base(orm.DeclarativeBase):
pass
# proposed (F)
class ProductRecord(Base):
"""A row of your products table, as far as geocatalog is concerned."""
__table__ = core_table("products", Base.metadata)
Moving between encodings is one query. DuckDB with its postgres and spatial extensions can COPY the table to GeoParquet, and geopandas does the same with read_postgis and to_parquet. A GeoParquet file is then a dated snapshot of the table, or the seed that fills it.
pgstac as a synced index
Your own PostGIS table is the catalog of record; pgstac is an optional search index fed from it.
| Symbol | Destination | Reason |
|---|---|---|
sync_to_pgstac | geocatalog.storage, extra [stac] | Renders records as STAC items and calls pgstac.upsert_items. |
pgstac does not fit the ORM pattern. Its items table is partitioned by collection and stores items "dehydrated", with the parts shared by a collection stripped out, so a row is not a plain STAC item and should not be written row by row. Writes go through its SQL functions (upsert_items and friends, which pypgstac and stac-fastapi call) and reads through its search. Objects of your own also belong outside the pgstac schema, since its migrations may remove them.
The way out is to decide which table is the catalog of record. Make it your own PostGIS table, and treat pgstac as a search index fed from it:
Icechunk repo meta/ + products/ truth for the data │ publish(tag), after the commit ▼ products table PostGIS, your schema catalog of record │ ProductRecord maps the core; apps add their own columns │ sync: render STAC items, call pgstac.upsert_items optional ▼ pgstac STAC search index rebuildable from the table │ stac-fastapi ▼ STAC API STACSource reads it back, other tools find your products
# geocatalog/_src/storage/pgstac_sync.py
"""Copy product records into pgstac as STAC items, after they are committed."""
import json
import sqlalchemy as sa
import sqlalchemy.orm as orm
# Shapes: N records in one collection
def sync_to_pgstac(session: orm.Session, engine: sa.Engine, collection: str) -> int:
"""Upsert every record of a collection into pgstac; a rerun changes nothing."""
# proposed (F)
query = sa.select(ProductRecord).where(ProductRecord.collection == collection)
# not pinned (sqlalchemy)
records = session.scalars(query).all() # → (N,)
# proposed (F)
items = [to_stac_item(record) for record in records] # (N,) → (N,)
payload = json.dumps(items)
# not pinned (pgstac): its SQL function, never row INSERTs
statement = sa.text("SELECT pgstac.upsert_items(CAST(:items AS jsonb))")
with engine.begin() as connection:
connection.execute(statement, {"items": payload})
return len(items)
ProductRecord; pgstac, if you want STAC search, is an index synced from it with upsert_items. One ORM, one schema owner, and pgstac stays disposable.PgstacCatalog writes with upsert_items and reads with search. Simpler to run, but your apps' extra fields must live inside the STAC item, and there is no ORM.Testing gates
Each workstream merges only when its gate passes. This corrects two ids from the L2 page: its F4 and F5 belong to the new workstreams, so they are K1 and L1 here.
| Gate | Workstream | Passes when |
|---|---|---|
| F1 Rebuild | F | Dropping a product collection and publishing every tag again gives the same record ids, geometries, hrefs and links. |
| F2 Commit first | F | A publish that fails after the commit leaves the repo valid, and a rerun gives the same catalog as an uninterrupted run. |
| F3 Round trip | F | On every adapter, products.search over the site returns rows whose filepaths open the same groups that load_scenes reads, and every derived_from link resolves in the source catalog. |
| K1 Encodings | K | A record written through ProductRecord, exported to GeoParquet, rendered as a STAC item and loaded back keeps every core field: equal strings, equal times, geometries equal to 1e-9 degrees. |
| L1 Index parity | L | After sync_to_pgstac, a pgstac search over the site returns the same ids as a PostGIS query on the products table; rerunning the sync changes no row. |
Sequencing and risks
The record first, because every adapter depends on it; then publishing with the server-free adapter; then the databases.
K one record, three encodings
│
◆ K1
│
F publish: GeoParquet adapter, then PostGIS
│
◆ F1 · F2 · F3
│
L pgstac sync optional
│
◆ L1
- !
Records outlive their snapshots. Expiring snapshots would leave records pointing at nothing. Fallback: publish tags only, and never delete a tag the catalog references; deleting one first removes its records.
- !
Encodings drift. A field added to one encoding but not the others. Fallback: every encoding is generated from
CORE_FIELDS, and K1 runs in CI. - !
Two writers to one table. Your app and
publishboth write rows. Fallback:publishowns the core columns, apps own theirs, and upserts touch only the columns they map. - !
pgstac's function names are unverified here.
upsert_itemscomes from its client libraries, not a running database. Fallback: go through stac-fastapi's Transactions extension until L1 has run against a real instance.
Sources
- geotoolz at
640670c:geocatalog/_src/_schema.py,storage/stac.py,storage/streaming.py,sources/stac.py - PostGIS, stac-geoparquet, pgstac and its docs, stac-fastapi-pgstac, the STAC API Transactions extension
- Level 2 collections in GeoStack and pipekit recipe registries, the companion pages