Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

RS_AsBase64

Introduction: Returns a base64 encoded string of the given raster. If the datatype is integral then this function internally takes the first 4 bands as RGBA, and converts them to the PNG format, finally produces a base64 string. When the datatype is not integral, the function converts the raster to TIFF format, and then generates a base64 string. To visualize other bands, please use it together with RS_Band. You can take the resulting base64 string in an online viewer to check how the image looks like.

Warning

This is not recommended for large files.

Format:

RS_AsBase64(raster: Raster, maxWidth: Integer)

RS_AsBase64(raster: Raster)

Since: v1.5.0

SQL Example

SELECT RS_AsBase64(raster) from rasters

Output:

iVBORw0KGgoAAAA...