Skip to main content
WherobotsDB stores tables in Apache Iceberg and supports Iceberg format-version 3 (V3). New tables in Wherobots-managed catalogs, such as org_catalog, are V3 tables. Tables created before September 15, 2026 were created at format-version 2 (V2), and Wherobots doesn’t raise them to V3. To check a table, run SHOW TBLPROPERTIES <table> ('format-version'). Geometry and geography columns declared with a CRS, such as GEOMETRY(4326), use the V3 geometry and geography types. Wherobots adds a raster column type and the CREATE SPATIAL INDEX statement, which rewrites a table’s data files clustered by a spatial column. On V3 tables, merge-on-read DELETE, UPDATE, and MERGE write deletion vectors, the row lineage columns _row_id and _last_updated_sequence_number can be queried, and variant columns can be written and read. Column default values can’t be set, and a table with a timestamp_ns column can’t be read. A raster column can hold in-db or out-db rasters, and you can use the raster functions in WherobotsDB to manipulate them. This document describes how to use the raster data type and raster functions in tables.

Raster as a primitive type

Wherobots adds a raster column type to Apache Iceberg tables. For instance, user can create a table with a raster column using SQL:
This will create an empty table with a raster column rast. We can inspect the table schema using DESCRIBE command:
Or using .printSchema() function:
SHOW CREATE TABLE prints a raster column as rast BINARY on a format-version 3 table. The column still holds rasters, stored the same way as on a format-version 2 table.

Creating table with raster column

As mentioned above, user can create a table with a raster column using SQL:
If user has a DataFrame containing raster data, they can also create a table from the DataFrame:

Writing data

Storing raster data in a table is similar to PostGIS. There are two options for storing raster data:
  • in-db raster: raster data completely stored in a table.
  • out-db raster: raster data is stored in an external file (such as GeoTIFF file on S3) and the table stores the path to the file and geo-referencing metadata of that raster.

In-DB Raster

To construct in-db raster data and write them to a table, user can use RS_FromGeoTiff to construct a raster value and write the DataFrame using .writeTo(...).append()
Or user can first load the GeoTIFF file as out-db raster using RS_FromPath, then use RS_AsInDB to convert the out-db raster to in-db raster:

Out-DB Raster

To construct out-db raster data and write them to a table, user can use RS_FromPath to construct a raster value and insert it into the table:

Writing a DataFrame to a table

Users can write a DataFrame containing raster data to a table:

ACID Transactions

Raster tables support the table update statements of Apache Iceberg, such as UPDATE, DELETE and MERGE INTO, in both copy-on-write and merge-on-read mode. The syntax is identical to the open source Apache Iceberg, please refer to Apache Iceberg - Write with SQL for more information.

Querying data

User can load data from a table using sedona.table(...):
You can apply some configurations for reading the table, such as the split size if you want to read the table into a DataFrame with more partitions:
You can run spatial range query on the table using Spatial SQL:
Or using the DataFrame API:
Users can also load a table by specifying the name of the data source explicitly using .format("iceberg"), this will load an isolated table reference that will not automatically refresh tables used by queries.
WherobotsDB optimizes raster spatial range queries using data skipping. This feature allows user to skip reading data files that don’t contain data that satisfy the spatial filter. Please refer to Spatial Filter Push-down for Rasters for more information.

Working with raster data

Data in columns with raster type will be loaded as RasterUDT values in WherobotsDB, user can use any RS_ functions provided by WherobotsDB to manipulate the raster data. For example, user can use RS_MapAlgebra to create a new raster by applying a map algebra expression to the raster column:
The resulting DataFrame can also be written back to a table using a CTAS statement:
Or simply call writeTo function on the resulting DataFrame of the query:

Further reading

WherobotsDB tables are Apache Iceberg tables. Please refer to Apache Iceberg documentation for Spark for more information. Out-db rasters usually requires tuning to achieve good performance. To learn more about out-db rasters, please refer to Out-DB Rasters. WherobotsDB supports spatial filter push-down for raster columns. Please refer to Spatial Filter Push-down for Rasters to learn how to take advantage of this feature.