SedonaRaster
DataFrame.collect() and Python UDFs receive raster column values as
SedonaRaster objects. Read the pixels with as_numpy or
as_rasterio, and the georeferencing with affine_trans and
crs_wkt. Call close, or use the raster as a context manager,
to release the resources it holds.
Sedona creates these objects when it reads a raster value; you do not
construct them yourself.
Parameters
affine_trans
bands_meta
crs_wkt
height
width
as_numpy()
as_numpy_masked()
as_rasterio()
close()
with_bands()
InDbSedonaRaster); other rasters
raise TypeError.
Parameters
New pixel data, of shape (height, width) for a single band or
(bands, height, width). Height and width must match this raster;
the band count and dtype may differ.
NODATA value of the output bands: a scalar for every band, or one
value per band. Use
float('nan') for a band without NODATA. When
omitted, the output bands inherit NODATA from the source bands.Returns
AffineTransform
Import fromsedona.spark.raster.meta.
col and row row maps to
x = ip_x + col * scale_x + row * skew_x and
y = ip_y + col * skew_y + row * scale_y. repr() shows the transform
as a 3x3 matrix.
Parameters
Whether
ip_x and ip_y refer to the center or the upper-left
corner of that pixel.translate()
Parameters
Returns
A new transform whose origin is pixel (
offset_x, offset_y)
of this one, for example the transform of a tile cut from the raster.with_anchor()
Parameters
Returns
This transform if it already uses
pixel_anchor; otherwise a new
transform whose origin is shifted by half a pixel.PixelAnchor
Import fromsedona.spark.raster.meta.
Anchor of the pixel cell. GeoTools anchors the coordinates at the center
of pixels, while GDAL anchors the coordinates at the upper-left corner of
the pixels. This difference requires us to convert the affine
transformation between these conventions.
Values
SampleDimension
Import fromsedona.spark.raster.meta.
Parameters
SedonaUtils
Import fromsedona.spark.raster_utils.SedonaUtils.
display_image()
- A raster column (GridCoverage2D) — auto-applies RS_AsImage
- An HTML image column from RS_AsImage() — renders directly

