API Reference Overview
GeoBrix provides APIs in three languages: Scala, Python, and SQL. All APIs provide access to the same underlying functionality with language-appropriate idioms.
Function References
For detailed documentation of each function with parameters, return values, and examples:
- RasterX Function Reference - Complete reference for all raster functions
- GridX Function Reference - Complete reference for all BNG grid functions
- VectorX Function Reference - Complete reference for all vector functions
API Languages
Scala
The native implementation language, providing the most direct access to GeoBrix functionality.
Python
Python bindings via PySpark, providing Pythonic access to all GeoBrix features.
SQL
SQL functions registered in the Spark catalog, usable from any SQL context.
Function Naming Convention
All GeoBrix SQL functions use the gbx_ prefix to clearly identify them as GeoBrix functions:
| Package | Prefix | Example |
|---|---|---|
| RasterX | gbx_rst_ | gbx_rst_boundingbox |
| GridX/BNG | gbx_bng_ | gbx_bng_cellarea |
| VectorX | gbx_st_ | gbx_st_legacyaswkb |
This makes it easy to:
- Identify GeoBrix functions in your code
- Distinguish from Databricks built-in
st_*functions - Track usage and attribution
Registration
Before using GeoBrix functions in Python or SQL, you must register them:
Python
from databricks.labs.gbx.rasterx import functions as rx
from databricks.labs.gbx.gridx.bng import functions as bx
from databricks.labs.gbx.vectorx.jts.legacy import functions as vx
# Register each package
rx.register(spark)
bx.register(spark)
vx.register(spark)
Registered RasterX, GridX, and VectorX functions.
Scala
import com.databricks.labs.gbx.rasterx.{functions => rx}
import com.databricks.labs.gbx.gridx.bng.{functions => bx}
import com.databricks.labs.gbx.vectorx.jts.legacy.{functions => vx}
// Register each package
rx.register(spark)
bx.register(spark)
vx.register(spark)
RasterX, GridX, and VectorX functions registered (gbx_rst_*, gbx_bng_*, gbx_st_*).
SQL
SQL functions are registered via Python or Scala. Once registered, they're available in any SQL context:
-- No registration needed in SQL
-- Functions are available after Python/Scala registration
SHOW FUNCTIONS LIKE 'gbx_*';
+--------------------+
|function |
+--------------------+
|gbx_rst_asformat |
|gbx_rst_avg |
|gbx_rst_bandmetadata|
+--------------------+
API Categories
RasterX Functions
Functions for raster data processing:
- Accessors: Get raster properties (width, height, bounds, metadata)
- Constructors: Load or create rasters
- Transformations: Clip, reproject rasters
- Grid Operations: Raster to grid conversions
- Band Operations: Multi-band raster operations
- Aggregations: Combine and merge rasters
GridX Functions
Functions for grid indexing (BNG):
- Cell Operations: Create and manipulate grid cells
- Coordinate Conversion: Convert between coordinates and grid references
- Grid Properties: Get grid cell attributes
- Spatial Indexing: Use grid cells for efficient spatial operations
VectorX Functions
Functions for vector operations:
- Geometry Conversion: Convert legacy formats to WKB/WKT
- Format Transformation: Prepare data for Databricks spatial types