Skip to main content

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:

API Languages

Scala

The native implementation language, providing the most direct access to GeoBrix functionality.

Scala API Documentation →

Python

Python bindings via PySpark, providing Pythonic access to all GeoBrix features.

Python API Documentation →

SQL

SQL functions registered in the Spark catalog, usable from any SQL context.

SQL API Documentation →

Function Naming Convention

All GeoBrix SQL functions use the gbx_ prefix to clearly identify them as GeoBrix functions:

PackagePrefixExample
RasterXgbx_rst_gbx_rst_boundingbox
GridX/BNGgbx_bng_gbx_bng_cellarea
VectorXgbx_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)
Example output
Registered RasterX, GridX, and VectorX functions.

Scala

Register All Packages
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)
Example output
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_*';
Example output
+--------------------+
|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

View RasterX Functions →

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

View GridX Functions →

VectorX Functions

Functions for vector operations:

  • Geometry Conversion: Convert legacy formats to WKB/WKT
  • Format Transformation: Prepare data for Databricks spatial types

View VectorX Functions →

Next Steps