Skip to main content

File GeoDatabase Reader

Since: file_gdb_gbx v0.4.0

file_gdb_gbx reads ESRI File Geodatabases. It is pure Python (pyogrio-backed) and needs no JAR. It produces the (attrs..., geom_0, geom_0_srid, geom_0_srid_proj) schema.

Options​

File Geodatabases contain multiple feature classes (layers). file_gdb_gbx presets the OpenFileGDB driver and exposes a feature-class selector.

OptionDefaultDescription
chunkSize"10000"Features per unit of work. The layer is streamed in batches of this many features, so per-task memory scales with chunkSize, not layer size.
layerNumber"0"Feature-class index to read (0-based, first feature class). Ignored when layerName is set.
layerName"" (first feature class)Feature-class (layer) name to read; takes precedence over the index when set.
asWKB"true"Output geometry as WKB (binary) vs WKT (text).
codedDomains"code"Fields with a coded-value domain return the stored code in the field's declared type ("code", the default) or the domain's description as a string ("description"; a code not listed in the domain returns the code as text). Range domains pass through unchanged.

All other vector reader options (driverName, …) are also available.

Zipped input: a .gdb.zip (or a plain .zip wrapping a single .gdb) is read transparently. GDAL opens it via /vsizip/, so just point .load() at the archive (or a directory of them). No option is required. This is the layout the file_gdb_gbx writer produces with zip=true.

Basic usage​

# Lightweight File Geodatabase reader (pyogrio; no JAR)
from databricks.labs.gbx import register
register(spark)
df = spark.read.format("file_gdb_gbx").load(SAMPLE) # (attrs..., <geom>, <geom>_srid, <geom>_srid_proj)
df.show()

The reader has Python and SQL bindings.

Typical pipeline: ingest into a table​

The common pattern is to land File Geodatabase directories in a table for downstream analytics — on Databricks a managed table is Delta:

df = spark.read.format("file_gdb_gbx").load("/Volumes/main/geo/raw/") # a folder of .gdb directories
df.write.mode("overwrite").saveAsTable("main.geo.parcels") # Delta table on Databricks

Reading a folder fans the files across the cluster, one partition per file, so ingest scales with the data. A single-node pyogrio.read_* parses one file on one machine. See Benchmarking for ingest figures.

Output Schema​

File Geodatabases typically use SHAPE as the geometry column name:

root
|-- SHAPE: binary (geometry in WKB format)
|-- SHAPE_srid: integer (spatial reference ID)
|-- SHAPE_srid_proj: string (projection definition)
|-- <attribute_columns>: various types
Column Names

Column names in File Geodatabases are case-insensitive.

The reader is read-only: the OpenFileGDB driver cannot write. To write a File Geodatabase, use the file_gdb_gbx writer.

Next Steps​

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 capabilityUsed here?How / why
list_local_files (session-free enumeration)UsedDirectory reads — recursive, include_hidden, extensions, and path_glob_filter are routed through this shared predicate for all format-specific readers.
gbx_file_read / FILE-tier readNot in the DataSourceThe DataSource is session-less on Connect; FILE-tier reads go through vector_file_read (function layer) which injects _file_ref on the driver before mapInPandas.
gbx_file_write / FILE-tier writeNot in the DataSourceFILE-tier writes go through vector_file_write (function layer). The DataSource writer commits via FUSE.
Shared file-access 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.