RS_Value or RS_BandAsArray. It is more appropriate to load large raster files as out-db rasters.
Currently supports loading GeoTiff files (*.tiff or *.tif) and Arc Info Ascii Grid files (*.asc).
Additional parameters for configuring the Hadoop file system can be passed in as a ; delimited string. For example, fs.s3a.access.key=xxx;fs.s3a.secret.key=xxx. The same string also carries reader settings such as raster.reader.auto-rescale=false, described in Band values, scale, and offset.
Band values, scale, and offset
RS_FromPath applies the per-band scale and offset stored in a GeoTIFF’s GDAL metadata by default (raster.reader.auto-rescale defaults to true). STAC catalogs expose the same two values as scale and offset in the raster:bands extension. Every SQL function that reads pixels from the raster, such as RS_Value, RS_BandAsArray, RS_MapAlgebra, RS_ZonalStats, and RS_AsInDB, therefore returns values in physical units rather than the raw digital numbers (DNs) stored in the file.
- Rescaled bands are returned as doubles:
RS_BandPixelTypereportsREAL_64BITSeven when the file stores 16-bit integers. - Nodata pixels are not rescaled. They keep the file’s nodata value, and
RS_BandNoDataValuestill reports that value. - Files without scale and offset metadata are returned unchanged, in their native pixel type.
sentinel-2-c1-l2a collection on Earth Search) store surface reflectance as 16-bit DNs with scale 0.0001 and offset -0.1. A vegetated near-infrared pixel stored as DN 3345 reads as reflectance 0.2345, because 3345 * 0.0001 - 0.1 = 0.2345:
1000) come out slightly below 0, while nodata pixels stay at the file’s nodata value (0 for Sentinel-2). Filter both before computing ratios such as NDVI.
Disabling rescaling
Passraster.reader.auto-rescale=false in the params string to keep the raw DNs and the file’s native pixel type:
spark.hadoop.raster.reader.auto-rescale=false when the session is created. It then applies to every RS_FromPath call that does not override it in params.
Other loaders
Not every entry point rescales by default:Python raster UDFs read the pixels of an out-db raster directly from the source file through rasterio, which does not apply the scale and offset.
raster.as_numpy() and raster.as_rasterio() on an out-db raster return the raw DNs even though SQL functions on the same raster return rescaled values by default. Convert with RS_AsInDB before the UDF, or apply the scale and offset in the UDF yourself, when the two must agree. In-db rasters carry the already rescaled values into the UDF.Signatures
Parameters
String
required
The path to the raster image file.
String
A
; delimited string of additional parameters for configuring the Hadoop file system and the reader. For example, fs.s3a.access.key=xxx;fs.s3a.secret.key=xxx, or raster.reader.auto-rescale=false to keep raw digital numbers (see Band values, scale, and offset).Boolean
default:"false"
If set to
true, the metadata of the raster file will be loaded immediately and any errors encountered reading the raster file will be reported. If false, only the path to the raster file is kept without loading it, until the metadata is actually needed.Return type
The resulting out-db raster.

