Show:

An encapsulation of a Dataset's raster bands.

var bands = dataset.bands;`

Methods

count () Number

Returns the number of bands.

Returns:

Number
countAsync
(
  • callback=undefined
)
Promise

Returns the number of bands. 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
create
(
  • dataType
  • options
)
gdal.RasterBand

Adds a new band.

Parameters:

  • dataType String

    Type of band (see GDT constants).

  • [options] Object | String[] optional

    Creation options

Returns:

createAsync
(
  • dataType
  • options
  • callback=undefined
)
Promise

Adds a new band. 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:

  • dataType String

    Type of band (see GDT constants).

  • [options] Object | String[] optional

    Creation options

  • [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
forEach
(
  • callback
)

Defined in lib/iterators.js:9

Iterates through all bands using a callback function. Note: GDAL band indexes start at 1, not 0.

Parameters:

  • callback forEachCb

    The callback to be called with each RasterBand

Example:

dataset.bands.forEach(function(band, i) { ... });`
get
(
  • id
)
gdal.RasterBand

Returns the band with the given ID.

Parameters:

  • id Number

Returns:

getAsync
(
  • id
  • callback=undefined
)
Promise

Returns the band with the given ID. 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:

  • id Number
  • [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
getEnvelope () Envelope

Defined in lib/gdal.js:205

Returns a Envelope object for the raster bands

Returns:

Envelope

Example:

const extent = dataset.getEnvelope()
map<U>
(
  • callback
)
U[]

Iterates through raster bands using a callback function and builds an array of the returned values.

Parameters:

  • callback mapCb

    The callback to be called with each RasterBand

Returns:

U[]

Example:

var result = dataset.bands.map(function(array, i) {
    return value;
});`
Symbol.asyncIterator ()

Defined in lib/iterators.js:54

Iterates through all bands using an async iterator

Example:

for await (const band of dataset.bands) {
}`
Symbol.iterator ()

Defined in lib/iterators.js:28

Iterates through all bands using an iterator

Example:

for (const band of dataset.bands) {
}`

Attributes

ds

gdal.Dataset readonly

Parent dataset