Show:

A single raster band (or channel).

Methods

asMDArray () gdal.MDArray

Return a view of this raster band as a 2D multidimensional GDALMDArray.

The band must be linked to a GDALDataset.

If the dataset has a geotransform attached, the X and Y dimensions of the returned array will have an associated indexing variable.

Requires GDAL>=3.3 with MDArray support, won't be defined otherwise

Returns:

computeStatistics
(
  • allow_approximation
)
Stats

Computes image statistics.

Returns the minimum, maximum, mean and standard deviation of all pixel values in this band. If approximate statistics are sufficient, the allow_approximation argument can be set to true in which case overviews, or a subset of image tiles may be used in computing the statistics.

Parameters:

  • allow_approximation Boolean

    If true statistics may be computed based on overviews or a subset of all tiles.

Returns:

Stats:

Statistics containing "min", "max", "mean", "std_dev" properties.

computeStatisticsAsync
(
  • allow_approximation
  • callback=undefined
)
Promise

Computes image statistics. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Returns the minimum, maximum, mean and standard deviation of all pixel values in this band. If approximate statistics are sufficient, the allow_approximation argument can be set to true in which case overviews, or a subset of image tiles may be used in computing the statistics.

Parameters:

  • allow_approximation Boolean

    If true statistics may be computed based on overviews or a subset of all tiles.

  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise:

Statistics containing "min", "max", "mean", "std_dev" properties.

createMaskBand
(
  • flags
)

Adds a mask band to the current band.

Parameters:

  • flags Number

    Mask flags

fill
(
  • real_value
  • imaginary_value
)

Fill this band with a constant value.

Parameters:

  • real_value Number
  • [imaginary_value] Number optional
fillAsync
(
  • real_value
  • imaginary_value
  • callback=undefined
)
Promise

Fill this band with a constant value. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • real_value Number
  • [imaginary_value] Number optional
  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
flush ()

Saves changes to disk.

flushAsync
(
  • callback=undefined
)
Promise

Saves changes to disk. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
getMaskBand () gdal.RasterBand

Return the mask band associated with the band.

Returns:

getMaskFlags () Number

Return the status flags of the mask band associated with the band.

The result will be a bitwise OR-ed set of status flags with the following available definitions that may be extended in the future:

  • GMF_ALL_VALID (0x01): There are no invalid pixels, all mask values will be 255. When used this will normally be the only flag set.
  • GMF_PER_DATASET (0x02): The mask band is shared between all bands on the dataset.
  • GMF_ALPHA (0x04): The mask band is actually an alpha band and may have values other than 0 and 255.
  • GMF_NODATA (0x08): Indicates the mask is actually being generated from nodata values. (mutually exclusive of GMF_ALPHA)

Returns:

Number:

Mask flags

getMetadata
(
  • domain
)
Any

Returns band metadata

Parameters:

  • [domain] String optional

Returns:

Any
getMetadataAsync
(
  • domain
  • callback=undefined
)
Promise

Returns band metadata. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • [domain] String optional
  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
getStatistics
(
  • allow_approximation
  • force
)
Object

Fetch image statistics.

Returns the minimum, maximum, mean and standard deviation of all pixel values in this band. If approximate statistics are sufficient, the allow_approximation argument can be set to true in which case overviews, or a subset of image tiles may be used in computing the statistics.

Parameters:

  • allow_approximation Boolean

    If true statistics may be computed based on overviews or a subset of all tiles.

  • force Boolean

    If false statistics will only be returned if it can be done without rescanning the image.

Returns:

Object:

Statistics containing "min", "max", "mean", "std_dev" properties.

setMetadata
(
  • metadata
  • domain
)
Boolean

Set metadata. Can return a warning (false) for formats not supporting persistent metadata.

Parameters:

  • metadata Object | String[]
  • [domain] String optional

Returns:

Boolean
setMetadataAsync
(
  • metadata
  • domain
  • callback=undefined
)
Promise

Set metadata. Can return a warning (false) for formats not supporting persistent metadata. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • metadata Object | String[]
  • [domain] String optional
  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
setStatistics
(
  • min
  • max
  • mean
  • std_dev
)

Set statistics on the band. This method can be used to store min/max/mean/standard deviation statistics.

Parameters:

  • min Number
  • max Number
  • mean Number
  • std_dev Number

Attributes

blockSize

Xyz readonly

Size object containing "x" and "y" properties.

blockSizeAsync

Promise readonly

Size object containing "x" and "y" properties. Asynchronous read-only getter. Returns a Promise that resolves with the result.

categoryNames

String

List of list of category names for this raster.

categoryNamesAsync

Promise readonly

List of list of category names for this raster. Asynchronous read-only getter. Returns a Promise that resolves with the result.

colorInterpretation

String | Null

Color interpretation mode (see GCI constants).

colorInterpretationAsync

Promise readonly

Color interpretation mode (see GCI constants). Asynchronous read-only getter. Returns a Promise that resolves with the result.

colorTable

gdal.ColorTable | Null

Color table (ColorTable).

colorTableAsync

Promise readonly

Color table (ColorTable). Asynchronous read-only getter. Returns a Promise that resolves with the result.

dataType

String | Null readonly

Pixel data type (see GDT constants) used for this band.

dataTypeAsync

Promise readonly

Pixel data type (see GDT constants) used for this band. Asynchronous read-only getter. Returns a Promise that resolves with the result.

description

String readonly

Name of of band.

descriptionAsync

Promise readonly

Name of of band. Asynchronous read-only getter. Returns a Promise that resolves with the result.

ds

gdal.Dataset readonly

hasArbitraryOverviews

Boolean readonly

An indicator if the underlying datastore can compute arbitrary overviews efficiently, such as is the case with OGDI over a network. Datastores with arbitrary overviews don't generally have any fixed overviews, but GDAL's RasterIO() method can be used in downsampling mode to get overview data efficiently.

hasArbitraryOverviewsAsync

Promise readonly

An indicator if the underlying datastore can compute arbitrary overviews efficiently, such as is the case with OGDI over a network. Datastores with arbitrary overviews don't generally have any fixed overviews, but GDAL's RasterIO() method can be used in downsampling mode to get overview data efficiently. Asynchronous read-only getter. Returns a Promise that resolves with the result.

id

Number | Null readonly

idAsync

Promise async_getter readonly

maximum

Number | Null readonly

Maximum value for this band.

maximumAsync

Promise readonly

Maximum value for this band. Asynchronous read-only getter. Returns a Promise that resolves with the result.

minimum

Number | Null readonly

Minimum value for this band.

minimumAsync

Promise readonly

Minimum value for this band. Asynchronous read-only getter. Returns a Promise that resolves with the result.

noDataValue

Number | Null

No data value for this band.

noDataValueAsync

Promise readonly

No data value for this band. Asynchronous read-only getter. Returns a Promise that resolves with the result.

offset

Number | Null

Raster value offset.

offsetAsync

Promise readonly

Raster value offset. Asynchronous read-only getter. Returns a Promise that resolves with the result.

readOnly

Boolean readonly

Indicates if the band is read-only.

readOnlyAsync

Promise readonly

Indicates if the band is read-only. Asynchronous read-only getter. Returns a Promise that resolves with the result.

scale

Number | Null

Raster value scale.

scaleAsync

Promise readonly

Raster value scale. Asynchronous read-only getter. Returns a Promise that resolves with the result.

size

Xyz readonly

Size object containing "x" and "y" properties.

sizeAsync

Promise readonly

Size object containing "x" and "y" properties. Asynchronous read-only getter. Returns a Promise that resolves with the result.

unitType

String | Null

Raster unit type (name for the units of this raster's values). For instance, it might be "m" for an elevation model in meters, or "ft" for feet. If no units are available, a value of "" will be returned.

unitTypeAsync

Promise readonly

Raster unit type (name for the units of this raster's values). For instance, it might be "m" for an elevation model in meters, or "ft" for feet. If no units are available, a value of "" will be returned. Asynchronous read-only getter. Returns a Promise that resolves with the result.