gdal.RasterBandPixels
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);`
Table of Contents
Methods
get
-
x
-
y
Returns the value at the x, y coordinate.
Parameters:
-
x
Integer -
y
Integer
Returns:
read
-
x
-
y
-
width
-
height
-
[data] The [TypedArray]
-
options
Reads a region of pixels.
Parameters:
-
x
Integer -
y
Integer -
width
Integer -
height
Integer -
[data] The [TypedArray]
TypedArray(https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView#Typed_array_subclasses) 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 optionalSee GDT constants.
-
[pixel_space]
Integer optional -
[line_space]
Integer optional
-
Returns:
A TypedArray of values.
readAsync
-
x
-
y
-
width
-
height
-
[data] The [TypedArray]
-
options
-
callback
Asynchronously reads a region of pixels. 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:
-
x
Integer -
y
Integer -
width
Integer -
height
Integer -
[data] The [TypedArray]
TypedArray(https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView#Typed_array_subclasses) 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 optionalSee GDT constants.
-
[pixel_space]
Integer optional -
[line_space]
Integer optional
-
-
[callback]
RequestCallback optionalPromisifiable callback, always the last parameter, can be specified even if certain optional parameters are omitted
Returns:
A TypedArray of values.
readBlock
-
x
-
y
-
[data] The [TypedArray]
Reads a block of pixels.
Parameters:
-
x
Integer -
y
Integer -
[data] The [TypedArray]
TypedArray(https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView#Typed_array_subclasses) to put the data in. A new array is created if not given.
Returns:
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
TypedArrayThe 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
-
writeAsync
-
x
-
y
-
width
-
height
-
data
-
options
-
callback
Asynchronously writes a region of pixels. 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:
-
x
Integer -
y
Integer -
width
Integer -
height
Integer -
data
TypedArrayThe 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
-
-
[callback]
RequestCallback optionalPromisifiable callback, always the last parameter, can be specified even if certain optional parameters are omitted
writeBlock
-
x
-
y
-
data
Writes a block of pixels.
Parameters:
-
x
Integer -
y
Integer -
data
TypedArrayThe TypedArray of values to write to the band.