New in 0.6.0
GeoBrix 0.6.0 restructures how you install, register and call the library. One wheel per runtime carries the whole native stack. Every function runs on every compute, and the JAR adds speed where it helps. This page lists what is new. Changes lists the behavior a user notices, and Breaking changes lists what to update. The migration guide maps each 0.5.x form to its 0.6 form.
One install per runtime
- Install one env wheel, chosen by runtime.
geobrix-<version>+env6-py3-none-any.whl: Serverless environment 6, DBR 19, DBR 19 ML, SQL warehouses and Unity Catalog functions.geobrix-<version>+env5-py3-none-any.whl: Serverless environment 5, DBR 17.3, DBR 18 and Lakeflow pipelines on theCURRENTchannel.
- The wheel carries everything GeoBrix runs on. That is GDAL 3.13.3, PROJ 9.9.0 and GEOS 3.15.0, the GeoBrix Rust module and the GeoBrix JAR.
rasterio,pyogrio,pyproj,shapely,netCDF4and GDAL's ownosgeoare built against that stack. A process runs one GDAL.- The wheel holds the runtime's preinstalled packages instead of replacing them.
- Its extras are
stac,vizxanddatabricks, pluszarron env6.
- No init script and no GDAL bundle. The Python and JVM levels both use the wheel's stack. GeoBrix verified this on x86 for DBR 17.3, 18 and 19, and on Graviton (arm64) for DBR 19.
- The wheel of the other family refuses to import and names the file to install.
See Installation.
The native stack
The GDAL build in the env wheel adds these:
- JPEG XL reads: the
JPEGXLdriver and the GeoTIFFJXLcodec. GeoBrix's writers do not offerJXL. - The
muparserdialect forraster calc, andREGEXPin GDAL's SQLite dialect. - libcurl with HTTP/2, and JPEG decoding with SIMD.
- Three PROJ grids (OSTN15, OSGM15 and EGM96) and the
projsyncgrid downloader.
See GeoBrix's GDAL build and GDAL drivers as provided.
Stage the JAR from the wheel: gbx.stage_jar
gbx.stage_jar(vol_dir)copies the wheel's JAR to a Volume folder. It writes a.sha256file beside it and checks the JAR against the wheel's version.- It refuses a folder that already holds another GeoBrix JAR, because a cluster loads one.
- It prints the next step: add the path as a cluster library on a dedicated cluster, then restart the cluster.
- On standard access mode, a metastore admin must first allowlist the Volume path.
registerrefuses a JAR whose version differs from the wheel's.
See Env wheel and JAR.
Install without PyPI access
- The env wheel lists every wheel it needs, pinned and hashed, for x86_64 and aarch64, with each extra's and the Unity Catalog pins.
python -m databricks.labs.gbx.stage depsdownloads those wheels on any machine with PyPI access. It checks each hash and proves offline that the set is complete.gbx.stage_deps(vol_dir, src=...)copies them to a Volume, sha256-checked, and prints the install lines for a notebook, Serverless, a cluster and Unity Catalog.
See Install without PyPI access.
Every function on every compute
- Every function runs at the Python level. It runs on Serverless, standard and dedicated clusters, Lakeflow pipelines and the Unity Catalog sandbox. No JAR is needed.
- The JVM level runs a function only where it measured faster. The JAR keeps a JVM form only where it ran at least 1.2x faster than the best Python form, with the same output. It needs dedicated compute. Which functions run where lists the result.
- A few functions run as SQL expressions, with no JAR and no Python. They are
gbx_bng_cellarea,gbx_bng_eastnorthasbng,gbx_quadbin_distance,gbx_quadbin_kringandgbx_quadbin_kloop. - Rust kernels run inside the Python level. They serve BNG cell encoding and TIN triangulation. If the module cannot load, GeoBrix runs the pure-Python form.
- Unity Catalog functions serve SQL warehouses, dashboards and Genie. See Unity Catalog functions.
See Surfaces & Levels.
One Python API and one registrar
gbx.register(spark)registers every function and every*_gbxdata source. Callfrom databricks.labs import gbx, thengbx.register(spark).- It picks the best level for each function on the compute. When a function falls back to another level, it prints the reason once.
gbx.register(spark, only=["gbx_rst_width"])limits the functions. A name no function matches raises aValueError.- The Python API also registers a function on its first call. In a Lakeflow pipeline it registers on the first call in each flow. See Lakeflow SDP.
- A notebook cell that ends in
gbx.register(spark)shows one summary line. The line gives the version, the count at each level and the first fallback note. The result is aRegisterResult, adictsubclass. - The first
registerof a session prints a short reminder. It names the env wheel, the registrar and the Python API, and links the migration guide.
One Python API
- The Python API is
rasterx,gridx.<grid>,vectorxandpmtiles. One import path serves every compute.<grid>isbng,quadbin,customorh3. - Every function keeps its name.
rasterx.functions.rst_width,gridx.bng.functions.bng_tessellateandvectorx.functions.st_makevalidare examples. - Python-only helpers live in
helpersmodules.rasterx.helpersholdsmerge_by_key,combine_by_key,retile_virtual,prepare_cogs,mint_vrt,rst_viewshed_towersand the*_groupedfunctions.gridx.helpersandvectorx.helpershold the grid and vector helpers.
The migration guide maps each old import to its new one.
Unity Catalog functions
gbx.uc.install(catalog, schema, volume_dir)creates GeoBrix functions in Unity Catalog. Run it once from a Serverless environment 6 or DBR 19 notebook. SQL warehouses, dashboards and Genie then call<catalog>.<schema>.gbx_*.- The install covers 226 of the 258 GeoBrix functions. The aggregates and
PARTITION BYtable functions have no Unity Catalog form. Most of them have an_arrayform or a recipe instead. - A geometry goes in as a
GEOMETRYwith an integer SRID. A CRS is an integer SRID,EPSG:<n>orESRI:<n>. A wrong SRID is refused with aFix:. gbx.uc.installgives every Python function one shared package list by default. A statement that calls several GeoBrix functions then starts one sandbox. Passdeps="per-function"to give each function its own list.gbx_bng_kring,gbx_bng_aswkbandgbx_bng_centroidrun as Scala functions when the install folder holds the JAR. Stage it withgbx.stage_jar. Without the JAR they run as Python functions, with the same answers.stubs=Truecreates a raising function for each session-only scalar. Its error names the route on Unity Catalog. Stubs are off by default.deps="volume"installs the functions without PyPI access. The sandbox installs from wheels thatgbx.stage_depsput on a Volume. See Install without PyPI access.- Each function's COMMENT starts with
geobrix <version>.gbx.register(spark, catalog=..., schema=...)says once when that schema holds another version.
See Unity Catalog functions and Installation.
Forms that need no session
These forms answer on Unity Catalog where the session form is an aggregate or a grouped table function:
- Cell fills and BNG chip sets:
gbx_h3_cellfill_array,gbx_quadbin_cellfill_array,gbx_bng_cellfill_array,gbx_custom_cellfill_array,gbx_bng_cellintersection_arrayandgbx_bng_cellunion_array. Call each withGROUP BYandcollect_list. - Vector arrays:
gbx_st_asmvt_array,gbx_st_coverageisvalid_arrayandgbx_st_coverageinvalidedges_arrayanswer as their aggregates do. - Two-step statistics:
gbx_rst_binpoints_partialwithgbx_rst_binpoints_finalize, andgbx_rst_stats_partial. Merge the partial state withGROUP BY. - Raster-to-grid state:
gbx_rst_h3_rastertogrid_partial,gbx_rst_quadbin_rastertogrid_partial,gbx_rst_bng_rastertogrid_partialandgbx_rst_custom_rastertogrid_partialserve several statistics in one pass. - Cell rasterizers:
gbx_rst_h3_rasterize,gbx_rst_quadbin_rasterize,gbx_rst_bng_rasterizeandgbx_rst_custom_rasterizetakecollect_list(struct(cellid, value)). - Table functions: the tiling, tessellation, pyramid, polygonize and TIN functions run on Unity Catalog. Call each with
LATERAL. Each takes an input and a result up to its stated size limit, and refuses a larger one with aFix:.
Session functions on UC gives the route for each session function without a Unity Catalog form, with recipes and size limits.
Unity Catalog SQL examples
- Twelve SQL files of Unity Catalog SQL examples cover every function by category. Install the functions into a schema, then run the queries in the SQL editor.
Readers and writers in Python
- Every reader and writer is a pure-Python data source named
<format>_gbx. They run on every compute and need no JAR.- Raster:
raster_gbx,gtiff_gbx,cog_gbx,netcdf_gbx,zarr_gbxandpmtiles_gbx. - Vector:
vector_gbx,shapefile_gbx,geojson_gbx,geojsonl_gbx,gpkg_gbxandfile_gdb_gbx. - Other:
file_gbx,lidar_gbxandexif_gbx.
- Raster:
file_gdb_gbxwrites File Geodatabases on any compute, on x86 and ARM. ItstargetArcGisVersionoption keeps 64-bit integer, date and timestamp columns exact for ArcGIS Pro 3.2 or later. See GeoDatabase Writer.netcdf_gbxvector mode reads CF discrete sampling geometries. Each profile or trajectory observation is a point, with its time as aTIMESTAMP. Times, dates and flags read asTIMESTAMP,DATEandBOOLEAN.read_tiles_table(spark, table, options)reads a tile index.versionAsOfandtimestampAsOfread the index as it was. See Raster Reader.- The FileGDB and GeoPackage readers read coded-value domains. The
codedDomainsoption returns the stored code or the description. See FileGDB Reader.
List the GDAL drivers: gbx_drivers
gbx_drivers()lists the GDAL drivers that the current environment can run. Pass'raster'or'vector'to keep one kind. In Python, calldrivers()fromdatabricks.labs.gbx.drivers.functions.- Each row says what the driver reads and writes, and whether GeoBrix allows it. It also says whether a raster can be held as tile bytes, and what the driver
requires. - The rows reflect the environment as it runs now. The
shippedcolumn marks the drivers of the env wheel's own build.
See the General Function Reference.
Incremental ingestion
read_paths and declare_ingest
-
read_pathsreads a DataFrame of file paths with any*_gbxreader. Give it a batch listing or an Auto Loader stream, and a reader name. Rows carry the reader's columns plus_source_pathand_source_mtime. Seeread_paths. -
declare_ingestdeclares an Auto Loader flow in a Lakeflow pipeline.on_changesets what happens when a file is overwritten:scd2(default): append-only rows, with a versions table and a_currentview.replace: latest content only.append: every delivery.
Set bad records aside: on_error
declare_ingest(on_error="quarantine")is the default. What cannot be read goes to<table>_bad_records, and the rest goes to the table.on_error="fail"fails the update on the first error and names the file.- A bad record is the smallest part of a file its reader can set aside. That is a vector feature, a raster tile window, a run of LiDAR points, a PMTiles tile or a NetCDF variable. Otherwise it is the whole file.
- Errors of the environment fail the update. Out of memory, a missing module and a Volume I/O error are not about the data, so they write no bad record.
read_paths(on_error="skip")skips what cannot be read and logs a warning. The default,"fail", fails the read and names the file.
See Unreadable data and Unreadable files.
One multi-format Lakeflow connector
- The
geobrixconnector reads vector, LiDAR, EXIF, GeoTIFF, COG, NetCDF and PMTiles files with the same code asread_paths. formattakes a reader name, asread_pathsdoes. A folder that mixes file kinds needs it. Otherwise the reader follows the file extension.
See the Lakeflow connector.
Transactional, versioned Zarr stores
- GeoBrix registers, reads and writes Zarr stores in transactions. A store's manifest is a Delta table. A version of the store is a version of that table, and one Delta transaction is one store transaction.
gbx_zarr_registerregisters an existing Zarr v2 or v3 store in place. It does not copy or write to the store. Several tables can register one store, each as its own branch.gbx_zarr_read,gbx_zarr_sampleand thezarr_gbxreader read stores by label or position. A read returns blocks, a table of cells or virtual tiles, so everyrst_*function works on a cube.gbx_zarr_writecreates, appends to, updates and overwrites a store in one transaction. Nothing is visible until the write commits.- Writers that touch different chunks both land. Writers that meet on one chunk get a
ZarrWriteConflictthat names the keys. - It takes a table of cells, one row per cell, with no packing into blocks. See Write from a table of cells.
transactional=Falsewrites a plain Zarr store with no manifest table.
- Writers that touch different chunks both land. Writers that meet on one chunk get a
- Versions.
gbx_zarr_history,gbx_zarr_tag,gbx_zarr_restore,gbx_zarr_optimizeandgbx_zarr_vacuummanage the history. Read an older version withversion_as_ofortimestamp_as_of. gbx_zarr_syncrecords the changes other tools made as one new version.gbx_zarr_exportpublishes, copies or writes a reference file.- Requirements. Zarr runs on DBR 19 and Serverless environment 6, with no JAR. Install the env6 wheel with its
[zarr]extra.
See Zarr Stores, Zarr Reader, Zarr Writer and Known Limitations.
Direct storage access
access="direct"reads and writes a store's files straight from the Volume's cloud storage. It uses temporary Unity Catalog credentials. It is several times faster than the Volume mount for many small reads.access="auto"(default) uses direct access on dedicated compute and the Volume mount elsewhere, Serverless included.- Direct access sends credentials to the executors. They last at most one hour and cover only the one Volume. Turn on local-disk encryption on clusters that use it, or pass
access="fuse".
File modes
- The default
file_modeis"fuse", so a store reads from every compute."auto"and"external"keep FILE references where the File type preview is on. - A store made in FILE mode needs FILE-enabled compute. To move it elsewhere, copy it with
gbx_zarr_export(method="copy")and register the copy withfile_mode="fuse".
New functions
gbx_rst_gdal(tile, command)runs an allowlisted GDALrasterstep or pipeline on a tile. An example command is'reproject --output-crs=EPSG:3857 ! slope ! hillshade --zfactor=2'.- Only listed steps and arguments run. A value is never a file, a URL or a
/vsiname. - It runs in session SQL and Python on every compute.
- Only listed steps and arguments run. A value is never a file, a URL or a
- Cell rasterizers without a
GROUP BY.gbx_rst_h3_rasterize,gbx_rst_quadbin_rasterize,gbx_rst_bng_rasterizeandgbx_rst_custom_rasterizeburn an array of cells into one GeoTIFF. - Table functions for large groups.
gbx_rst_merge_tvfmerges each key's tiles into one raster.gbx_rst_bng_rasterize_tvfburns each key's BNG cells into one raster. Both read a row at a time. Call them asTABLE(...) PARTITION BY (key). gbx_drivers()lists the GDAL drivers. See above.gbx_rst_fromfilereads a FILE value. With a clip or a target resolution, it reads only the COG blocks it needs, in notebooks, SQL warehouses and Unity Catalog. Seerst_fromfile.- The Unity Catalog forms listed under Forms that need no session.
segment_raster(..., weights=)loads a GeoSAM checkpoint from a Volume. A workspace that blocks internet egress then needs no download. See GeoSAM.run_sfm(..., prior_sigma_m=)sets the accuracy of GPS pose priors when EXIF gives none. See Orthomosaic.
A Databricks Container Service image
- A GeoBrix image runs every function, and the JVM level, on a dedicated DBR 19 cluster. There is no cluster library to attach.
- Graviton (arm64):
mjohns797/geobrix:<version>-env6-arm, ormjohns797/geobrix:env6-armfor the newest release. - x86 (amd64):
mjohns797/geobrix:<version>-env6-x86, ormjohns797/geobrix:env6-x86.
- Graviton (arm64):
- The image carries the env6 wheel with
[vizx]and the GeoBrix JAR. Each release attaches a Dockerfile to build your own. - Verified. Each image ran on a dedicated DBR 19 cluster before its release. The digests are on the DCS page.
- Limits. There is no DBR 17.3 or 18 image.
See Databricks Container Service.
Performance
- TIN functions run up to 80x faster at the Python level. The env wheel triangulates with a Rust port of JTS and gives the JVM level's triangles. A 250,000-point grid takes about 2 seconds, down from about 150. See the Rust kernel for TIN.
- Raster tessellation scales to scene-sized tiles. Each tile is built from its own window, so large scenes no longer time out. See Raster tessellation.
- The vector readers stream large layers. Layers with more than 2 GiB of geometry now read, and memory per task follows
chunkSize. See Vector Readers. - Merges and combines over the memory budget stream and return the mosaic. A group of virtual tiles merges in the same memory at any size. See Tile reads and the memory cap.
- Tile functions move rows to Python in Arrow batches on DBR 19 and Serverless. Large tiles no longer spend half of each task in garbage collection.
- Raster opens list each folder once per worker, not at every open. On a Volume, each open used to take 0.3 s to 10 s. See Sidecar files and folder listings.
rst_sampleon a virtual tile reads only the block that holds its point.- Zarr reads spread over the session's cores in tasks of about 16 MiB decoded.
Performance has the measurements.
Sample-data downloaders and Genie helpers
FirePerimeterDownloaderfetches a wildfire perimeter by name from the NIFC WFIGS service, with an optional year and state. See Fire Perimeter Downloader.WorldPopDownloaderwindows the WorldPop 2020 population grid of the USA to a bbox. See WorldPop Downloader.databricks.labs.gbx.geniebuilds a Genie space and asks a Genie Agent.build_serialized_spaceandapply_spacecreate or update a space, andaskreturns the answer and its SQL. See Genie Helpers.
Examples
- Weather Features with Zarr registers, samples, writes back and versions a weather cube.
- Zarr at Scale reads and writes Zarr stores from 10 MB to 10 GB.
- Unity Catalog SQL examples run every Unity Catalog function from the SQL editor.
- The Lakeflow examples run on DBR 19 on the
PREVIEWchannel, with the env6 wheel. Set the bundle variablepipeline_channeltoCURRENT, with the env5 wheel, for DBR 18.