RasterLayer Class

Summary: Represents a raster layer.

Module: aspose.gis.raster

Full Name: aspose.gis.raster.RasterLayer

Aspose.PSD Version: 25.9.0

Properties

NameTypeAccessDescription
band_countintrGets the number of bands in the raster layer.
boundsRasterRectrGets the raster bounds.
cell_sizeIRasterCellSizerGets cell or pixel size of the raster.
driverDriverrGets the RasterLayer.driver that instantiated this layer.
heightintrGets the height of the raster in pixels. Also it is known as rows count.
no_data_valuesIRasterValuesrGets the values that represents background or ’no data’ of the raster.
spatial_reference_systemSpatialReferenceSystemrGets a spatial reference system of raster.
Can be if it is unknown.
upper_left_xdoublerGets x-coordinate of the raster upper left corner.
upper_left_ydoublerGets y-coordinate of the raster upper left corner.
widthintrGets the width of the raster in pixels. Also it is known as columns count.

Methods

NameDescription
crop(geometry, masks)Crops the raster layer using a shape form (and band mask).
crop(masks)Crops the raster layer using a band mask).
get_band(index)Gets a band by the specified index.
get_extent()Calculates a spatial extent of this layer.
get_spatial_point(cell_x, cell_y)Converts the specified column and row to the spatial coordinate.
get_statistics(band_index, exclude_nodata_value)Calculate summary statistics consisting of count, sum, mean, min, max.
get_values(cell_x, cell_y)Reads the values in the specified cell.
get_values_dump(rect)Reads the values in the specified block as a 1-dimension array.
warp(options)Warps the raster layer to another.

Method: crop(geometry, masks)

 crop(geometry, masks) 

Crops the raster layer using a shape form (and band mask).

Parameters:

ParameterTypeDescription
geometryIGeometryGeometry represented the shape form.
masksdoubleMask for crop layer

Returns

TypeDescription
RasterLayerThe cropped raster layer. If no intersections found returns .

Method: crop(masks)

 crop(masks) 

Crops the raster layer using a band mask).

Parameters:

ParameterTypeDescription
masksdoubleMask for crop layer

Returns

TypeDescription
RasterLayerThe cropped raster layer. If no intersections found returns .

Method: get_band(index)

 get_band(index) 

Gets a band by the specified index.

Parameters:

ParameterTypeDescription
indexintBand numbers start at 0 and band is assumed to be 0 if not specified.

Returns

TypeDescription
IRasterBandReturns basic meta data about a raster band.

Method: get_extent()

 get_extent() 

Calculates a spatial extent of this layer.

Returns

TypeDescription
ExtentA spatial extent of this layer.

Method: get_spatial_point(cell_x, cell_y)

 get_spatial_point(cell_x, cell_y) 

Converts the specified column and row to the spatial coordinate.

Parameters:

ParameterTypeDescription
cell_xintThe value for column (x-coordinate). Numbering starts at 0.
cell_yintThe value for row (y-coordinate). Numbering starts at 0.

Returns

TypeDescription
IPointReturns the x-coordinate of upper left corner given a column and row.

Method: get_statistics(band_index, exclude_nodata_value)

 get_statistics(band_index, exclude_nodata_value) 

Calculate summary statistics consisting of count, sum, mean, min, max.

Parameters:

ParameterTypeDescription
band_indexintThe index of the band. Numbering starts from 0.
exclude_nodata_valueboolAllows to exclude ’nodata’ values. If ’excludeNodataValue’ is set to false, then all pixels are considered.

Returns

TypeDescription
RasterStatisticsThe summary statistics.

Method: get_values(cell_x, cell_y)

 get_values(cell_x, cell_y) 

Reads the values in the specified cell.

Parameters:

ParameterTypeDescription
cell_xintThe value for column (x-coordinate). Numbering starts at 0.
cell_yintThe value for row (y-coordinate). Numbering starts at 0.

Returns

TypeDescription
IRasterValuesThe raster values.

Method: get_values_dump(rect)

 get_values_dump(rect) 

Reads the values in the specified block as a 1-dimension array.

Parameters:

ParameterTypeDescription
rectRasterRectBlock of raster cells where dump is read.

Returns

TypeDescription
IRasterValues[]The dump of values.

Method: warp(options)

 warp(options) 

Warps the raster layer to another.

Parameters:

ParameterTypeDescription
optionsWarpOptionsOptions for the reprojection procedure.

Returns

TypeDescription
RasterLayerThe warp raster layer.