pip install geotoolz-catalog puts a geocatalog command on your PATH. It
maps thin wrappers over the same functions the Python API exposes —
nothing in the library is CLI-only — so you can mix it with cron, CI,
or a shell session without writing a Python script.
$ geocatalog --help
Usage: geocatalog COMMAND
Spatiotemporal catalog over geospatial files.geocatalog --version prints the installed geotoolz-catalog version
(the same string as geocatalog.__version__).
Subcommands¶
build¶
Builds a catalog from a glob of files and writes it as GeoParquet.
$ geocatalog build raster \
--input-glob "data/sentinel2/*.tif" \
--regex "S2_(?P<date>\d{8})_.+\.tif" \
--out catalog.parquet
wrote catalog.parquet (1247 rows)
$ geocatalog build vector \
--input-glob "labels/*.gpkg" \
--layer fields \
--out vector.parquet
$ geocatalog build xarray \
--input-glob "data/*.nc" \
--time-var time \
--out xarray.parquetbuild xarray requires the [xarray-raster] extra. The CLI surfaces a
clear error if the extra isn’t installed.
| Flag | Builders | Meaning |
|---|---|---|
--input-glob | all | Local glob over input files (** recurses). Required. |
--out | all | Destination GeoParquet path. Required. |
--crs | all | Catalog CRS (--target-crs is the deprecated spelling). raster with --engine memory and vector: defaults to the first file’s CRS. raster with --engine duckdb: defaults to EPSG:4326 (footprints are reprojected). xarray: tags the catalog, does not reproject. |
--regex | raster, vector | Filename regex with a (?P<date>...) group, or (?P<start>...) + (?P<stop>...). |
--date-format | raster, vector | strptime format for the regex groups (default %Y%m%d). |
--engine | raster | memory (default) builds in RAM (--backend is the deprecated spelling); duckdb streams rows straight to --out (needs the [duckdb] extra). |
--layer | vector | Layer name for multi-layer files (GeoPackage). |
--time-var | xarray | Name of the time coordinate (default time). |
An invalid --crs fails with a one-line message and exit code
1, as does a build vector input that is not a vector dataset. build raster reports a file it cannot open as a raster as an I/O error
(exit code 3).
query¶
Filter a catalog by bounds + time window and print the matching row count.
$ geocatalog query catalog.parquet \
--bounds "-5.2,36.1,-4.5,36.8" \
--start 2024-06-01 \
--end 2024-06-30
source catalog.parquet
rows 42
bounds (-5.2, 36.1, -4.5, 36.8)
bbox (-5.2, 36.1, -4.5, 36.8)
time ['2024-06-01', '2024-06-30']Pass --crs EPSG:32629 (or any other identifier) to interpret --bounds
in a non-default CRS. (--bbox is the deprecated spelling of
--bounds; the output repeats bounds as bbox for one release.) The library reprojects internally. A --crs that
pyproj does not recognise fails with a one-line message and exit code 1.
--start and --end are paired — pass either both or neither.
Passing only one is rejected with exit code 1.
stats¶
Top-line metadata about an artifact — rows, bounds, temporal extent,
kind, CRS (backend repeats kind for one release). On an empty
catalog the temporal extent prints as
None.
$ geocatalog stats catalog.parquet
rows 1247891
bounds [-15.2, 36.1, 4.5, 47.2]
temporal_start 2021-01-01 00:00:00
temporal_end 2024-06-29 23:59:59
kind raster
backend raster
crs EPSG:4326info¶
Inspect a single row: its user columns and time window. Housekeeping
columns (_backend, _schema_version, the GeoParquet bbox covering)
are not shown.
$ geocatalog info catalog.parquet --row 0
filepath /archive/sentinel-2/S2_20210101_T29SND.tif
geometry POLYGON ((...))
start_time 2021-01-01 00:00:00
end_time 2021-01-01 23:59:59.999999convert¶
Rewrite an existing GeoParquet artifact, optionally into a Hive-partitioned
directory. When --out is omitted, single.parquet converts to single/.
$ geocatalog convert single.parquet --partition-by year,month
source single.parquet
out single
rows 1247891migrate¶
Rewrite an artifact in place at a target schema version. A thin
wrapper over migrate_geoparquet; see
Schema versions for the migration policy.
$ geocatalog migrate catalog.parquet
catalog.parquet already at v0
$ geocatalog migrate catalog.parquet --to-version 0
catalog.parquet already at v0--to-version defaults to the reader’s current schema version
(SCHEMA_VERSION_CURRENT, currently 0 — so today every invocation
reports “already at v0”; once the schema version is bumped, older
artifacts print wrote catalog.parquet (v0 -> v1)). Migrations are
idempotent — re-running against an already-migrated artifact leaves
the file untouched.
Exit codes follow the shared table below: 3 when the source is
missing or unreadable, 2 on a corrupt artifact or schema mismatch
(CatalogSchemaError — for example an artifact written by a newer
reader, or a --to-version the artifact cannot migrate to). A
non-integer --to-version is an argument error (exit 1).
Output formats¶
Every subcommand except migrate accepts --json to switch from the
human-readable table to a JSON object. This is the right choice when piping into
jq, a workflow scheduler, or another tool.
$ geocatalog stats catalog.parquet --json | jq .rows
1247891
$ geocatalog build raster --input-glob "data/*.tif" \
--regex "S2_(?P<date>\d{8})_.+\.tif" \
--out catalog.parquet --json
{"out": "catalog.parquet", "rows": 42}Exit codes¶
| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | User error — bad or unparseable args (including an invalid --crs), glob matched nothing, a build vector input that is not a vector dataset, missing extra. |
| 2 | Catalog error — corrupt artifact or unrecognised schema (e.g. a newer _schema_version). |
| 3 | I/O error — source path doesn’t exist or can’t be read. |