Skip to main content

Readers Overview

GeoBrix provides Spark readers for geospatial file formats.

Keeping a table in sync with a landing folder?

See Ingestion Pipelines: a Lakeflow connector, Auto Loader pipelines and read_paths read only the new and changed files with these readers, and track what changed.

GeoBrix ships native Python DataSource V2 readers. They need no JAR.

Distributed readers, virtual tiles by default

These are Spark DataSource V2 readers (not single-node rasterio/pyogrio wrappers). Work is partitioned and read in parallel across the cluster. Vector readers read each file in its own task and stream it in batches of chunkSize features (memory follows chunkSize, not file size). Raster readers split large files by sizeInMB. The result is a distributed DataFrame with no driver-side collect. Raster readers load virtual tiles by default — bytes-free (path, window) refs that read pixels lazily, so a multi-gigabyte raster fans into tiles without OOM (.option("virtualTiles", "false") for materialized reads). See Virtual Tiles.

Register first

The Python DataSources are not auto-registered. Call register(spark) once per session before you use any *_gbx format:

from databricks.labs.gbx import register

register(spark) # every gbx_* function and every *_gbx reader and writer

The call registers all readers and writers. There is no call that registers only some of them.

Which formats can this runtime read and write?

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. Use kind ('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
On Serverless, read from a FILE-column table

The Delta-scan FILE-column-table read path is the recommended read path on Serverless. A tile index read with read_tiles_table (raster) or vector_file_read(table) (vector) scans the Delta table and resolves FILE references in the scan, with no per-tile open.

The raster_gbx directory DataSource path pays its own file open on the worker for each tile. On Serverless, each open is a Volume round trip. Write your rasters or vectors to a FILE-column table first, then read from that table rather than the directory directly.

All tile reads are size-gated by a connect-aware cap. The cap is 64 MiB on Serverless and 256 MiB on classic compute in dedicated and standard access mode; override it with GBX_STREAM_MAX_BYTES. Files under the cap stream in full. Files over the cap open lazily, so reads never load an unbounded tile into executor memory. See Serverless & Memory for the full guide including write-path safety and caveats.

See the full capability tiers & read-options matrix.

Available Readers​

ReaderFormat NameDescription
Raster Readerraster_gbxPure-Python catch-all raster reader (no JAR; DataSource V2)
GeoTIFF Readergtiff_gbxPure-Python GeoTIFF reader (preset driver="GTiff")
COG Readercog_gbxPure-Python cloud-optimized GeoTIFF reader — windowed/overview-aware reads
NetCDF Readernetcdf_gbxPure-Python CF NetCDF reader — CF grids (raster) or CF-DSG points (vector)
File Readerfile_gbxPure-Python file lister — enumerates matching paths as rows (read-only)
Zarr Readerzarr_gbxPure-Python reader for Zarr v2 and v3 stores (no JAR): blocks, a table of cells or GeoBrix tiles, by label or position; gbx_zarr_read adds versions and sampling
PMTiles Readerpmtiles_gbxPure-Python PMTiles reader — mosaic pyramid from rasters (source="raster") or tiles from an archive (source="archive")
LiDAR Readerlidar_gbxPure-Python LAS/LAZ point-cloud reader (no JAR)
EXIF/GPS Readerexif_gbxPure-Python EXIF/GPS telemetry reader for drone/camera images (no JAR)
Vector Readervector_gbxPure-Python catch-all vector reader (pyogrio; same OGR schema)
Shapefile Readershapefile_gbxPure-Python Shapefile reader (preset OGR driver)
GeoJSON Readergeojson_gbxPure-Python GeoJSON reader (preset OGR driver)
GeoJSONL Readergeojsonl_gbxPure-Python newline-delimited GeoJSONL reader — reads GeoJSONSeq shard directories
GeoPackage Readergpkg_gbxPure-Python GeoPackage reader (preset OGR driver)
GeoDatabase Readerfile_gdb_gbxPure-Python File Geodatabase reader (preset OGR driver)

See the Raster Reader page for full raster usage/options, and the vector reader pages for the OGR (geom_0, geom_0_srid, geom_0_srid_proj, …attributes) schema.

.limit() and filters are not pushed into the reader — use the function layer for a bounded scan

The *_gbx DataSource readers enumerate the entire source at planning time, regardless of a downstream .limit(N), WHERE, or column projection. Spark 4.0.0's Python DataSource API exposes no limit/filter pushdown hook. A call such as spark.read.format("raster_gbx").load(dir).limit(10) therefore still lists, and plans a partition for, every file under dir. It then discards all but 10 rows afterward. The listing is a fast, stat-free directory walk, so this is cheap for typical directories; on a very large directory, every file is still planned.

When you want the limit (or a filter) honored during planning, use the function layer instead:

  • gbx_file_read(spark, dir).limit(N) — on a FILE-capable runtime this reads through the native read_files table function, which pushes .limit() and predicate/column filters, so only the needed files are enumerated.
  • rst_fromfile("path") — a per-row function returning virtual tiles, so gbx_file_read(dir).limit(N).select(..., rst_fromfile("path")) decodes only the N selected rows and reads no pixels until a downstream op forces it.

See GBX Common Functions.

FILE-column-table reads​

Both the raster and vector readers can read directly from a FILE-column Delta table in addition to Volume paths. Such a table has rows that carry FILE references to geospatial files. Both auto-order by the resolved source path by default. The ordering effect differs by format:

  • Raster (read_tiles_table, manifest) — a single GeoTIFF can produce many tile rows. Auto-ordering puts those tiles next to each other (in a manifest read, in adjacent partitions; in read_tiles_table, inside each task). A worker therefore opens the source file once for the windows it reads, amortizing the open cost. See Raster Reader → tile index auto-order.
  • Vector (vector_file_read) — one vector file maps to exactly one table row (one FILE ref). Every source opens exactly once regardless of row order, so auto-ordering is a deterministic, cross-format-consistent default, not a throughput lever. See Vector Reader → Reading from a FILE-column table.

Both support an opt-out: skipOrdering="true" (raster DataSource option) and skip_ordering=True (vector_file_read kwarg). Use either when the table is already physically ordered (written with layout="order" or layout="cluster") to avoid the redundant sort step.

Benchmarks​

Per-format timing results are published on the Benchmarking page, with the methodology, the raster-function results and the PMTiles writer comparison.