GeoTIFF Reader
Since: gtiff_gbx v0.4.0
Read GeoTIFFs into the shared (source, tile) schema with gtiff_gbx. It is the
raster_gbx catch-all with the GeoTIFF driver preset. It is pure Python (rasterio-backed) and needs no JAR.
Options
gtiff_gbx presets the GeoTIFF driver. It inherits the raster_gbx options. Key options:
| Option | Default | Description |
|---|---|---|
virtualTiles | "true" | Default. Emit bytes-free virtual tiles — each row carries the source path + pixel window instead of raster bytes; pixels are read lazily when an operation needs them (the default, which keeps a large ingest within memory). Set "false" to materialize raster bytes into each row. See Virtual Tiles. |
splitStrategy | "none" | When to split large rasters: none (default — one tile per file), auto, serverless, classic. See Raster Options. |
sizeInMB | "-1" | Power-user budget override in MiB (positive value). -1 = use splitStrategy. |
clipPolygons | none | Area(s) of interest: one WKT/EWKT string, or a JSON-array string for a list. One tile per intersecting polygon; mutually exclusive with windows/tileSize. See Raster Options. |
windows | none | Pixel window(s): JSON 4-int array "[col,row,w,h]", or a JSON array of them. Mutually exclusive with clipPolygons/tileSize. |
clipCrs | none | CRS for clipPolygons lacking an embedded SRID (embedded SRID → clipCrs → raster CRS). |
tileSize | none | Regular fixed-size grid: "w,h" or a single "n" (square). One tile per cell; mutually exclusive with clipPolygons/windows. Materialized cells guarded to ~2 GB; virtual unguarded. See Raster Options. |
overlapPercent | 0 | Overlap % between tileSize cells (tileSize-only). See Raster Options. |
filterRegex | ".*" | When loading a directory, keep files whose full path matches this regex. |
The raster readers now emit virtual tiles by default (virtualTiles=true) — bytes-free
(path, window) references that read pixels lazily. Previously the reader materialized raster
bytes into every row. To restore materialized reads, pass .option("virtualTiles", "false").
A virtual tile that reaches the JVM level must be materialized first — see
Virtual Tiles.
The tileFormat, cogBlockSize, and cogOverviewResampling reader options are
removed. COG creation belongs to the cog_gbx writer — see
COG Writer. The gtiff_gbx writer still accepts cog=true to
re-encode a tile DataFrame as COG.
Basic usage
Use gtiff_gbx to make GeoTIFF reads explicit. Use raster_gbx for other raster formats.
Register the *_gbx DataSources first (see
Raster Readers → Register).
# Named lightweight GeoTIFF reader (preset for GeoTIFF)
df = spark.read.format("gtiff_gbx").load("{SAMPLE_RASTER_PATH}")
The reader has Python and SQL bindings.
Cloud-Optimized GeoTIFF (COG)
gtiff_gbx reads Cloud-Optimized GeoTIFFs like any GeoTIFF. For cloud storage, use an s3://, abfs://, or gs:// path.
COGs let the reader fetch only the bytes it needs. To prepare COGs and read windows from them, see the
COG Writer and the COG Reader.
Compression
gtiff_gbx reads compressed GeoTIFFs without an option. GDAL detects the compression (LZW, DEFLATE, JPEG, JPEG2000 or none).
GeoTIFF readers extract the CRS from the GTiff SRS tag and store it as a canonical string in tile.metadata and the tile.crs field (e.g. "EPSG:4326", "ESRI:54008"). ESRI and OGC authorities are preserved. The clipCrs option declares the CRS for a plain WKT/WKB clip polygon; an embedded SRID in an EWKT/EWKB polygon takes precedence. See Coordinate reference systems for the full CRS model.
Next Steps
- Raster Reader - Generic raster reader for all GDAL formats
- Raster Functions - Raster processing operations
- Quick Start - Get started with GeoBrix
- Ingestion Pipelines - ingest new and changed files incrementally
Common functions: used vs excluded
See GBX Common Functions for the full catalog of shared file-access primitives. The table below shows which are active in this reader and which are not, and why.
| Common capability | Used here? | How / why |
|---|---|---|
list_local_files (session-free enumeration) | Used | All directory reads — recursive, include_hidden, extensions, path_glob_filter options are routed through this shared predicate. |
enumerate_files (FILE-tier enumeration) | Not in the DataSource | The DataSource is session-less on Connect and does not call enumerate_files; FILE-tier enumeration is only available through gbx_file_read at the function layer. |
gbx_file_read / gbx_file_write (FILE tier) | Not in the DataSource | The DataSource is FUSE-only (session-less on Connect); FILE reads go through gbx_file_read → rst_fromfile at the function layer. |
The *_gbx readers use the shared file_gbx file-access base for FILE / FUSE routing and enumeration — capability tiers, the no-gating rule, and layout options are described there.