Readers & Writers
GeoBrix provides Spark DataSource V2 readers and writers for geospatial file formats. They are pure Python and need no JAR, so one set serves every compute. They scale by partitioning work across the cluster rather than reading or writing on a single node.
Call gbx_drivers() in SQL, or drivers() in Python, to list the drivers of the current environment. Each row says whether the driver reads, writes and is allowed by GeoBrix. It also says if the driver works as shipped, and what it still needs. Pass 'raster' or 'vector' to keep one kind. The tested column marks the drivers that GeoBrix's driver tests cover, and guidance points to a built-in reader where one exists. The result reflects the environment as it runs now, so adding or removing packages changes it. See the drivers in the env wheel for the shipped list.
SELECT driver, description, requires FROM gbx_drivers() WHERE write AND allowed
Readers
Load geospatial files into a distributed DataFrame. The raster readers (raster_gbx, gtiff_gbx, cog_gbx) return virtual tiles by default — bytes-free (path, window) references; pass .option("virtualTiles", "false") to get materialized bytes instead. See the Readers Overview
for the full list, output schemas, and options.
Parenthetical (x.y.z) is the GeoBrix release each reader/writer first shipped (its "since" version).
| Format | Reader |
|---|---|
| Raster (generic) | raster_gbx (0.4.0) |
| GeoTIFF | gtiff_gbx (0.4.0) |
| COG | cog_gbx (0.5.0) |
| NetCDF | netcdf_gbx (0.4.1) |
| Zarr | zarr_gbx (0.6.0) |
| PMTiles | pmtiles_gbx (0.4.0) |
| File lister | file_gbx (0.5.0) |
| LiDAR (LAS/LAZ) | lidar_gbx (0.5.2) |
| EXIF/GPS (images) | exif_gbx (0.5.2) |
| Vector (generic) | vector_gbx (0.4.0) |
| Shapefile | shapefile_gbx (0.4.0) |
| GeoJSON | geojson_gbx (0.4.0) |
| GeoJSONL | geojsonl_gbx (0.4.0) |
| GeoPackage | gpkg_gbx (0.4.0) |
| File Geodatabase | file_gdb_gbx (0.4.0) |
Writers
Write DataFrames back out to geospatial files. See the Writers Overview for the column contract, single-file vs sharded trade-offs, and per-format details.
| Format | Writer |
|---|---|
| Raster (generic) | raster_gbx (0.4.0) |
| GeoTIFF | gtiff_gbx (0.4.0) |
| COG | cog_gbx (0.5.0) |
| Zarr | gbx_zarr_write (0.6.0) |
| PMTiles | pmtiles_gbx (0.4.0) |
| NetCDF | netcdf_gbx (0.4.1) |
| LiDAR (LAS/LAZ) | lidar_gbx (0.5.2) |
| Vector (generic) | vector_gbx (0.4.0) |
| Shapefile | shapefile_gbx (0.4.0) |
| GeoJSON | geojson_gbx (0.4.0) |
| GeoJSONL | geojsonl_gbx (0.4.0) |
| GeoPackage | gpkg_gbx (0.4.0) |
| File Geodatabase | file_gdb_gbx (0.4.0) |
Registering the readers and writers
The Python DataSources are not auto-registered. Call register(spark) once per session
before using any *_gbx format. The same call registers the gbx_* functions:
from databricks.labs.gbx import register
register(spark)
Shared file-access base
All *_gbx readers and writers share a common file-access base — the
file_gbx module — that centralises FILE and FUSE routing, directory enumeration, and
write-mode selection.
Capability tiers
file_gbx probes the runtime once per session and picks the best available tier:
| Tier | Available on | Capabilities |
|---|---|---|
read_files | DBR 13.3 LTS + | read_files(format=>'file') — native FILE refs, file metadata, recursive listing |
list_files | DBR 18 LTS + | list_files(…) — metadata + FILE refs, directory listing only |
fuse | All runtimes (OSS / DBR < 13) | os.walk + FUSE mount — always available; no FILE column |
Read-options matrix
| Source | Read mechanism | Runtime | Per-tile cost | Default / when |
|---|---|---|---|---|
| FILE-column table (recommended on Serverless) | Delta scan of path (EXTERNAL) | any | None. The scan resolves the reference. | default for a table source (vector_file_read(table), raster read_tiles_table) |
| FILE-column table | Delta scan of FILE .uri (MANAGED) | DBR 13.3+ | None. The scan resolves the reference. | auto when the table is MANAGED |
| Directory | read_files(format=>'file') — enumerate + FILE refs + size | DBR 13.3+ | Listing only (metadata). | auto dir default on 13.3+ |
| Directory | list_files — enumerate (metadata only) | DBR 18+ | Listing only (metadata). | used when read_files is unavailable |
| Directory | FUSE walk + per-tile open (raster_gbx DataSource) | all | One file open per tile, on the worker. | fallback tile read (no FILE tier) |
The read_files and list_files rows list files. They do not open them. The DataSource row opens each tile on the worker, which costs a Volume round trip on Serverless. The FILE-column table path opens no tile in the scan. On Serverless, prefer reading from a FILE-column table (Delta scan). See Serverless & Memory for the connect-aware stream caps and a full guide to memory-safe pipelines. The cap is 64 MiB on Serverless and 256 MiB on classic compute, standard access mode included.
The no-gating rule: access="auto" on readers and file_mode="auto" on writers silently
downgrade to the best available tier and never error. Explicitly requesting
"managed" or "external" on a FUSE-only runtime raises a clear, actionable error
describing the upgrade path. Readers default to access="auto"; writers default to
file_mode="fuse", a plain Delta table that reads on every compute. Your pipelines run on any
runtime without code changes; you only need to opt in to FILE (file_mode="auto") when you
want the governance and lifecycle benefits.
Read resolver
When a *_gbx reader opens a source file it calls open_for_read(source, access="auto").
The resolver checks the tier and picks a strategy:
- FILE-capable runtime (DBR 13.3+): routes to the FILE API. Files at or under
GBX_STREAM_MAX_BYTES(default 64 MiB on Serverless, 256 MiB on classic compute, standard access mode included) open a byte-range stream. The stream is one round-trip, no FUSE, no local copy, and the fastest path for typical tile sizes. Files over the cap fall through toas_local_file(), a lazy local-file reference backed by the FILE handle. It pages bytes from the Volume on demand and is a memory-safety mechanism, not a performance optimization. A blanket FUSE-direct path for small files is slower, not faster; the streaming path is preferred whenever the file fits in the cap. Open dataset handles are held in a per-partition LRU cache keyed by source path, amortising the open cost across all windows of the same source. - FUSE fallback (OSS / DBR < 13): resolves to the bare
/Volumes/…path and uses a probe-then-stage strategy. It tries random-access directly and falls back to a sequential copy only if the probe fails.
Write committer
Writers call open_for_write(spark, df, target, file_mode="fuse", filespace=…, layout=…).
The default, file_mode="fuse", is a plain Delta write. file_mode="auto" opts in to FILE and
resolves as follows:
| Condition | Effective mode | Mechanism |
|---|---|---|
FILE available + filespace given | "managed" | create_file — MANAGED FILE column |
FILE available, no filespace | "external" | try_to_file — EXTERNAL FILE column |
| No FILE (fuse tier) | "fuse" | Plain Delta write, path STRING / raster BINARY |
Explicit modes ("managed", "external") override auto-selection. Requesting
"managed" or "external" on a fuse-only runtime raises a clear error.
Layout options
The layout parameter controls row ordering in the output Delta table:
| Value | Behaviour |
|---|---|
"order" | ORDER BY path at write time (default — scan-friendly) |
"cluster" | CLUSTER BY path in the DDL (FILE-mode tables only); run OPTIMIZE <table> afterward for durable clustering |
"plain" | No ordering — fastest write, scan order determined by the cluster |
partitionBy is not supported; use layout="order" unless you have a specific clustering need.
File enumeration
enumerate_files(path, *, recursive=True, include_hidden=False, extensions=None, path_glob_filter=None)
lists files in a directory and returns a Spark DataFrame (FILE-capable tiers) or a Python list (FUSE tier).
The result has columns path, size, and file (a FILE reference when available, None on FUSE).
By default, files whose names start with _ or . (Spark/Hadoop metadata files such as
_SUCCESS, _committed_*, .crc) are skipped. Pass include_hidden=True to include them.
A positive selection filter — either extensions (a tuple of suffixes, e.g. (".tif", ".nc"))
or path_glob_filter (an fnmatch-style glob, e.g. "*.tif") — narrows which files are returned.
The two filters are mutually exclusive and are ANDed with include_hidden: for example,
include_hidden=True + path_glob_filter="[!.]*" returns underscore-named files such as
_data.tif but still excludes dot-named files such as .crc.
The FILE flow

See file_gbx Reader for enumeration and read-mode details, and
file_gbx Writer for write-mode and ingest options.
Delta-indexed collections
Two parts of GeoBrix keep a Delta table as the index of a collection of files and leave the bytes in the files:
- a FILE-column table has one row per raster or vector file on a Volume, with a
FILEreference (a path string where FILE is not available). The*_gbxwriters make one throughfile_gbxand readers scan it (see Read-options matrix). A tile index (tilesTable) is the same idea with an optional pixel window on each row, read withread_tiles_table; - the manifest table of a Zarr store has one row per chunk or shard, per array and group
document, and one
commitrow for each write. A row records the file, offset and length that hold it.
It is one pattern, and in both the collection is a table. SQL, Unity Catalog grants and Delta's own tools work
on it. A reader plans from the table rather than from a directory listing, so it never walks the files to find
them. The table has versions that you can read as they were: versionAsOf and timestampAsOf on
read_tiles_table, version_as_of and timestamp_as_of on gbx_zarr_read.
What differs is who looks after the files. A Zarr store comes in two kinds: one you create, whose files GeoBrix writes, and one you register in place, whose files other tools own.
| FILE-column table or tile index | Zarr store you create | Zarr store you register | |
|---|---|---|---|
| Made by | The *_gbx writers; you, for a tile index | gbx_zarr_write with mode="create" | gbx_zarr_register |
| One row is | A file, or a window of one | A chunk or shard at an offset in a pack file that GeoBrix wrote | A chunk or shard at an offset in the store's own objects; for a writable registration, a pack file in its overlay is the same as in the previous column |
| Files | Referenced. An earlier version of the table lists the files it listed, but a file replaced since is replaced for every version | Written only by GeoBrix, each into a new pack file that is never changed. An earlier version reads the bytes it did, while it is within retain or tagged | The store's objects belong to the tools that wrote them. GeoBrix copies nothing and writes nothing in the store (an explicit publish aside), records each object's identity, and a read stops with ZarrStoreDrift if another tool changed one |
| Writes | A Delta transaction on the table | One Delta transaction for each write, with a compare-and-swap on every key it replaces, so concurrent writers either land or get a clear conflict error | None through GeoBrix for a read-only registration. A writable one writes new pack files to its overlay, in the same transactions |
| Cleaning up | Yours | gbx_zarr_vacuum deletes the files that no readable version needs | gbx_zarr_vacuum deletes only the packs GeoBrix wrote to the overlay; it never touches the store's own objects |
A FILE-column table suits files that other tools produce and own. A Zarr store suits a cube that jobs also write back to, and that needs all-or-nothing writes and versions. Choosing a Format shows where each format fits.
Next Steps
- Readers Overview — every reader, tier differences, output schemas, options.
- Writers Overview — the column contract, single-file vs sharded writers, per-format details.
- VRT & Mosaics — tile a large source into bounded mini-COGs + a portable VRT index; read back with
raster_gbxorcog_gbx. - Serverless & Memory — connect-aware caps, materialize-vs-virtual, memory-safe write patterns, and caveats.
- Benchmarking — tier-vs-tier timing and parity methodology.