Class: GeoTIFF

GeoTIFF(source, littleEndian, bigTiff, firstIFDOffset, optionsopt)

The abstraction for a whole GeoTIFF file.

Constructor

new GeoTIFF(source, littleEndian, bigTiff, firstIFDOffset, optionsopt)

Parameters:
Name Type Attributes Description
source Source

The datasource to read from.

littleEndian Boolean

Whether the image uses little endian.

bigTiff Boolean

Whether the image uses bigTIFF conventions.

firstIFDOffset Number

The numeric byte-offset from the start of the image to the first IFD.

options Object <optional>

further options.

Properties
Name Type Attributes Default Description
cache Boolean <optional>
false

whether or not decoded tiles shall be cached.

Source:

Extends

Methods

(async, static) fromSource(source, options, signalopt)

Parse a (Geo)TIFF file from the given source.

Parameters:
Name Type Attributes Description
source source~Source

The source of data to parse from.

options object

Additional options.

signal AbortSignal <optional>

An AbortSignal that may be signalled if the request is to be aborted

Source:

close()

Closes the underlying file buffer N.B. After the GeoTIFF has been completely processed it needs to be closed but only if it has been constructed from a file.

Source:

(async) getGhostValues() → {Object}

Get the values of the COG ghost area as a parsed map. See https://gdal.org/drivers/raster/cog.html#header-ghost-area for reference

Source:
Returns:

the parsed ghost area or null, if no such area was found

Type
Object

(async) getImage(indexopt) → {GeoTIFFImage}

Get the n-th internal subfile of an image. By default, the first is returned.

Parameters:
Name Type Attributes Default Description
index Number <optional>
0

the index of the image to return.

Source:
Returns:

the image at the given index

Type
GeoTIFFImage

(async) getImageCount() → {Number}

Returns the count of the internal subfiles.

Source:
Returns:

the number of internal subfile images

Type
Number

(async) parseFileDirectoryAt(offset) → {ImageFileDirectory}

Instructs to parse an image file directory at the given file offset. As there is no way to ensure that a location is indeed the start of an IFD, this function must be called with caution (e.g only using the IFD offsets from the headers or other IFDs).

Parameters:
Name Type Description
offset number

the offset to parse the IFD at

Source:
Returns:

the parsed IFD

Type
ImageFileDirectory

(async) readRasters(optionsopt) → {Promise.<(TypedArray|Array.<TypedArray>)>}

(experimental) Reads raster data from the best fitting image. This function uses the image with the lowest resolution that is still a higher resolution than the requested resolution. When specified, the bbox option is translated to the window option and the resX and resY to width and height respectively. Then, the readRasters method of the selected image is called and the result returned.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

optional parameters

Properties
Name Type Attributes Default Description
window Array <optional>
whole image

the subset to read data from.

bbox Array <optional>
whole image

the subset to read data from in geographical coordinates.

samples Array <optional>
all samples

the selection of samples to read from.

interleave Boolean <optional>
false

whether the data shall be read in one single array or separate arrays.

pool Number <optional>
null

The optional decoder pool to use.

width Number <optional>

The desired width of the output. When the width is not the same as the images, resampling will be performed.

height Number <optional>

The desired height of the output. When the width is not the same as the images, resampling will be performed.

resampleMethod String <optional>
'nearest'

The desired resampling method.

signal AbortSignal <optional>

An AbortSignal that may be signalled if the request is to be aborted

fillValue Number | Array.<Number> <optional>

The value to use for parts of the image outside of the images extent. When multiple samples are requested, an array of fill values can be passed.

Overrides:
Source:
See:
  • GeoTIFFImage.readRasters
Returns:

the decoded arrays as a promise

Type
Promise.<(TypedArray|Array.<TypedArray>)>