Show:

A representation of a RasterBand's pixels.

Note: Typed arrays should be created with an external ArrayBuffer for versions of node >= 0.11

var n = 16*16;
var data = new Float32Array(new ArrayBuffer(n*4));
//read data into the existing array
band.pixels.read(0,0,16,16,data);

Methods

get
(
  • x
  • y
)
Number

Returns the value at the x, y coordinate.

Parameters:

  • x Integer
  • y Integer

Returns:

Number
read
(
  • x
  • y
  • width
  • height
  • data
  • options
)
TypedArray

Reads a region of pixels.

Parameters:

  • x Integer
  • y Integer
  • width Integer
  • height Integer
  • [data] TypedArray optional

    The TypedArray to put the data in. A new array is created if not given.

  • [options] Object optional
    • [buffer_width=x_size] Integer optional
    • [buffer_height=y_size] Integer optional
    • [data_type] String optional
    • [pixel_space] Integer optional
    • [line_space] Integer optional

Returns:

TypedArray:

A TypedArray of values.

readBlock
(
  • x
  • y
  • data
)
TypedArray

Reads a block of pixels.

Parameters:

  • x Integer
  • y Integer
  • [data] TypedArray optional

    The TypedArray to put the data in. A new array is created if not given.

Returns:

TypedArray:

A TypedArray of values.

set
(
  • x
  • y
  • value
)

Sets the value at the x, y coordinate.

Parameters:

  • x Integer
  • y Integer
  • value Number
write
(
  • x
  • y
  • width
  • height
  • data
  • options
)

Writes a region of pixels.

Parameters:

  • x Integer
  • y Integer
  • width Integer
  • height Integer
  • data TypedArray

    The TypedArray to write to the band.

  • [options] Object optional
    • [buffer_width=x_size] Integer optional
    • [buffer_height=y_size] Integer optional
    • [pixel_space] Integer optional
    • [line_space] Integer optional
writeBlock
(
  • x
  • y
  • data
)

Writes a block of pixels.

Parameters:

  • x Integer
  • y Integer
  • data TypedArray

    The TypedArray of values to write to the band.