Skip to main content
To load GeoTIFF and Arc Info ASCII Grid (.asc) files, use the raster data source, sedona.read.format("raster").load(path), in place of RS_FromPath. The data source splits each file into tiles as it reads it, loads the raster metadata in parallel, and spreads the tiles across the cluster. RS_FromPath returns one untiled raster for each path.
Returns an out-db raster from a path to an image file. Out-db rasters hold references to raster files instead of holding the actual pixel data. Out-db rasters can be used interchangeably with ordinary rasters. The only difference is that out-db rasters will load raster files in a deferred manner. Pixel data won’t be loaded until pixel values are accessed by functions such as RS_Value or RS_BandAsArray. 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), so the pixel functions return physical units rather than the raw digital numbers (DNs) stored in the file. This differs from the raster data source, which keeps the raw DNs unless its autoRescale option is enabled. See Band values, scale, and offset for what rescaling changes. Pass raster.reader.auto-rescale=false in the params string to keep the raw DNs and the file’s native pixel type:
The same key can be set for a whole Spark session as the Hadoop configuration entry 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.

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.

Examples

Load an out-db raster from a path

Load an out-db raster with custom Hadoop file system parameters

Load an out-db raster without rescaling

Keeps the raw digital numbers and the native pixel type instead of applying the GeoTIFF’s scale and offset: