Skip to content

Save data to external storage

WherobotsDB has APIs that can save an entire raster column to files in a specified location.

Save In-DB Raster

Before saving, the raster type column needs to be converted to a binary format. WherobotsDB provides several functions to convert a raster column into a binary column suitable for file storage. Once in binary format, the raster data can then be written to files on disk using the WherobotsDB file storage APIs.

rasterDf.write.format("raster").option("rasterField", "raster").option("fileExtension", ".tiff").mode(SaveMode.Overwrite).save(dirPath)

WherobotsDB has a few writer functions that create the binary DataFrame necessary for saving the raster images.

As Arc Grid

Use RS_AsArcGrid to get binary Dataframe of raster in Arc Grid format.

SELECT RS_AsArcGrid(raster)

As GeoTiff

Use RS_AsGeoTiff to get binary Dataframe of raster in GeoTiff format.

SELECT RS_AsGeoTiff(raster)


Use RS_AsPNG to get binary Dataframe of raster in PNG format.


Please refer to Raster writer docs for more details.

Save Out-DB Raster

Out-DB raster must be saved in a Havasu (Iceberg) table. For more information, please refer to the Havasu documentation. Or, users can use RS_AsInDB to convert the out-db raster to in-db raster, and then save them to files.

Last update: May 20, 2024 07:48:29