Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Catalog — raster / xarray / vector backends

Catalog backends — raster, xarray, vector on real data

Three builders share one GeoCatalog shape. This notebook builds a catalog for each backend against real public data, then prints the underlying GeoDataFrame so the substrate diversity is concrete:

BackendReal source
build_raster_catalogEight Sentinel-2 L2A scenes over Lake Tahoe (MPC)
build_xarray_catalogCopernicus DEM GLO-30 tile over the same AOI, saved as a NetCDF
build_vector_catalogNatural Earth admin-1 polygons (Pacific states)
workdir: /var/folders/k9/_v6ywhvj0nq36tpttd3j4mq80000gn/T/geocatalog_backends_kpb4r__u

1. Raster backend — real Sentinel-2 L2A scenes

Eight cloud-free scenes over Lake Tahoe (June–July 2024). The catalog stores the signed asset URLs; pixel data is read lazily on load_raster.

InMemoryGeoCatalog(backend='raster', len=22, crs=<Projected CRS: EPSG:32610>
Name: WGS 84 / UTM zone 10N
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Between 126°W and 120°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); Northwest Territories (NWT); Nunavut; Yukon. United States (USA) - Alaska (AK).
- bounds: (-126.0, 0.0, -120.0, 84.0)
Coordinate Operation:
- name: UTM zone 10N
- method: Transverse Mercator
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
)
backend: raster

The catalog is literally a GeoDataFrame — show it.

Loading...

2. Xarray backend — Copernicus DEM

A real DEM tile saved to disk as NetCDF; bounds come from the coord min/max, time from a configurable coordinate (default "time"). We add a singleton-time dim so the xarray builder’s time-aware path is exercised even though a DEM is technically time-invariant.

Original xarray.Dataset:
<xarray.Dataset> Size: 1MB
Dimensions:    (time: 1, y: 972, x: 360)
Coordinates:
  * time       (time) datetime64[us] 8B 2024-01-01
  * y          (y) float64 8kB 39.27 39.27 39.27 39.27 ... 39.0 39.0 39.0 39.0
  * x          (x) float64 3kB -120.1 -120.1 -120.1 ... -120.0 -120.0 -120.0
Data variables:
    elevation  (time, y, x) float32 1MB 2.047e+03 2.042e+03 ... 1.897e+03
InMemoryGeoCatalog(backend='xarray', len=1, crs=<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
)
backend: xarray
n_timesteps: 1
Loading...

3. Vector backend — Natural Earth admin-1 polygons

Polygon footprints come from each file’s total_bounds in the target CRS. We persist one GeoPackage per state so the catalog has multiple rows.

wrote 3 admin GeoPackages to /var/folders/k9/_v6ywhvj0nq36tpttd3j4mq80000gn/T/geocatalog_backends_kpb4r__u
InMemoryGeoCatalog(backend='vector', len=3, crs=<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
)
backend: vector
Loading...

4. Rasterising the labels over the Lake Tahoe AOI

load_vector(..., task="semantic_segmentation") turns the polygon overlay into a label GeoTensor that lines up with any imagery you load over the same AOI — the foundation for a vision-model training pipeline.

label_tensor.values.shape: (1, 350, 170)
unique class IDs: [1, 3]
<Figure size 700x800 with 2 Axes>

5. GeoParquet roundtrip

Any catalog can be persisted as a GeoParquet artifact. The DuckDB backend (see 04_duckdb) reads the same format directly without materialising the dataframe.

wrote 21,363 bytes to /var/folders/k9/_v6ywhvj0nq36tpttd3j4mq80000gn/T/geocatalog_backends_kpb4r__u/raster_cat.parquet
recovered: InMemoryGeoCatalog(backend='raster', len=22, crs=<Projected CRS: EPSG:32610>
Name: WGS 84 / UTM zone 10N
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Between 126°W and 120°W, northern hemisphere between equator and 84°N, onshore and offshore. Canada - British Columbia (BC); Northwest Territories (NWT); Nunavut; Yukon. United States (USA) - Alaska (AK).
- bounds: (-126.0, 0.0, -120.0, 84.0)
Coordinate Operation:
- name: UTM zone 10N
- method: Transverse Mercator
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
)
len matches: True

Recap

Same GeoCatalog API, three substrates:

BuilderReadsStores per row
build_raster_catalogGeoTIFFs / .vsicurl/ URLsfilepath, bounds (footprint polygon), time interval
build_xarray_catalogNetCDF / zarrfilepath, bounds (from coord extent), time interval (from time coord), n_timesteps
build_vector_catalogGeoPackage / Shapefile / Parquetfilepath, bounds (total_bounds), time interval

All three round-trip through GeoParquet. All three implement the same GeoCatalog Protocol — query, intersect, union, where, load_* — so the set algebra and patching bridge demos work uniformly regardless of which builder you used.