In-DB raster vs. Out-DB raster
WherobotsDB supports two types of raster data: In-DB raster and Out-DB raster. In-DB raster stores the complete raster data in WherobotsDB. Out-DB rasters only holds the geo-referencing information of the raster, as well as the path to the actual raster data. The actual raster data is stored in remote storage, such as S3. Out-DB rasters are useful when the raster data is too large to be stored in parquet files, or when the raster data is already stored in some remote storage.
Create an Out-DB Raster type column
Out-DB Rasters has the same data type with In-DB Rasters, they are all represented asraster primitive type in Havasu and can be loaded as RasterUDT objects in Sedona. If user has a table containing a raster column, it can have both In-DB and Out-DB rasters
in that column.
Use the raster data loader
We can use theraster loader to load the data. The raster loader will load the binary files as out-db rasters and automatically split the raster into smaller tiles.
- Scala
- Java
- Python
x and y attached to each tile.
raster loader, please refer to Loading raster using the raster loader.
Use RS_FromPath to create Out-DB Raster
User can create an out-db raster usingRS_FromPath function:
- Python
- Scala
- Java
- Python
- Scala
- Java
RS_FromPath is an Out-db raster object, which can be stored in a raster column in a Havasu table.
Retrieve the path of Out-DB Rasters
The rasters path of out-db rasters can be retrieved usingRS_BandPath function. It will give the path of the raster file in remote storage. If the argument is an in-db raster, RS_BandPath will return NULL.
- Python
- Scala
- Java
Divide and explode Out-DB Rasters
Large Out-DB rasters can be subdivided into tiles usingRS_TileExplode function:
- Python
- Scala
- Java
RS_TileExplode produces are also Out-DB rasters as long as the input raster is an Out-DB raster. These tiles reference different parts of the same raster file in remote storage, so they are very cheap to create.
- Python
- Scala
- Java
Create Out-DB Raster from STAC GeoJSON files
This method is useful when dealing with large raster datasets stored in external storage systems like Amazon S3, as it allows the Havasu table to store only the path to the raster file along with geo-referencing metadata. The following examples shows how to read a STAC file using the GeoJSON reader, load raster data from the STAC file and write it as an out-db raster to a Havasu table.- Python
- Scala
- Java
Supported Out-DB Storages
Havasu supports any storages that Hadoop supports, as long as the storage has an implementation oforg.apache.hadoop.fs.FileSystem on the classpath of the Wherobots Cloud. In the above examples, we accessed out-db rasters stored on S3 using the S3A file system provided by Hadoop AWS. Following is a list of storages that are tested on Wherobots Cloud:
Create an In-DB Raster type column
All raster operations in Spatial SQL require Raster type objects. Therefore, this should be the next step after loading the data.Load binary raster data
Assume we have a single raster data file called rasterData.tiff, at Path. Use the following code to load the data and create a WherobotsDB Dataframe.- Scala
- Java
- Python
The above code works too for loading multiple raster data files. if the raster files are in separate directories and the option also makes sure that only
.tif or .tiff files are being loaded.- Scala
- Java
- Python
Recursive file lookup will also work similarly for raster datasets in .asc file formats.
From Geotiff
From Arc Grid
The raster data is loaded the same way astiff file, but the raster data is stored with the extension .asc, ASCII format. The following code creates a Raster type objects from binary data:

