gdal-async
Version:
Bindings to GDAL (Geospatial Data Abstraction Library) with full async support
2,118 lines (1,902 loc) • 236 kB
TypeScript
import * as stream from 'stream';
export type CalcOptions = {
convertNoData?: boolean;
convertInput?: boolean;
progress_cb?: ProgressCb;
}
export type Color = {
c1: number;
c2: number;
c3: number;
c4: number;
}
export type ContourOptions = {
src: RasterBand;
dst: Layer;
offset?: number;
interval?: number;
fixedLevels?: number[];
nodata?: number;
idField?: number;
elevField?: number;
progress_cb?: ProgressCb;
}
export type CreateOptions = {
progress_cb?: ProgressCb;
}
export type FillOptions = {
src: RasterBand;
mask?: RasterBand;
searchDist: number;
smoothingIterations?: number;
}
export type MDArrayOptions = {
origin: number[];
span: number[];
stride?: number[];
data_type?: string;
data?: TypedArray;
_offset?: number;
}
export type PixelFunction = Uint8Array
export type PolygonizeOptions = {
src: RasterBand;
dst: Layer;
mask?: RasterBand;
pixValField: number;
connectedness?: number;
useFloats?: boolean;
progress_cb?: ProgressCb;
}
export type ProgressCb = ( complete: number, msg: string ) => void
export type ProgressOptions = {
progress_cb: ProgressCb;
}
export type ReadOptions = {
buffer_width?: number;
buffer_height?: number;
type?: string;
data_type?: string;
pixel_space?: number;
line_space?: number;
resampling?: string;
progress_cb?: ProgressCb;
offset?: number;
}
export type ReprojectOptions = {
src: Dataset;
dst: Dataset;
s_srs: SpatialReference;
t_srs: SpatialReference;
resampling?: string;
cutline?: Geometry;
srcBands?: number[];
dstBands?: number[];
srcAlphaBand?: number;
dstAlphaBand?: number;
srcNodata?: number;
dstNodata?: number;
blend?: number;
memoryLimit?: number;
maxError?: number;
multi?: boolean;
options?: object;
progress_cb?: ProgressCb;
}
export type SieveOptions = {
src: RasterBand;
dst: RasterBand;
mask?: RasterBand;
threshold: number;
connectedness?: number;
progress_cb?: ProgressCb;
}
export type StringOptions = string[]|Record<string, string|number|(string|number)[]>
export type TypedArray = Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array
export type UtilOptions = {
progress_cb?: ProgressCb;
}
export type VRTBandDescriptor = {
sources: RasterBand[];
pixelFunc?: string;
pixelFuncArgs?: Record<string, string|number>;
dataType?: string;
sourceTransferType?: string;
description?: string;
}
export type VRTDescriptor = {
bands: VRTBandDescriptor[];
}
export type VSIStat = {
dev: number;
mode: number;
nlink: number;
uid: number;
gid: number;
rdev: number;
blksize: number;
ino: number;
size: number;
blocks: number;
atime: Date;
mtime: Date;
ctime: Date;
}
export type VSIStat64 = {
dev: BigInt;
mode: BigInt;
nlink: BigInt;
uid: BigInt;
gid: BigInt;
rdev: BigInt;
blksize: BigInt;
ino: BigInt;
size: BigInt;
blocks: BigInt;
atime: Date;
mtime: Date;
ctime: Date;
}
export type WarpOptions = {
src: Dataset;
s_srs: SpatialReference;
t_srs: SpatialReference;
maxError?: number;
}
export type WarpOutput = {
rasterSize: xyz;
geoTransform: number[];
}
export type WriteOptions = {
buffer_width?: number;
buffer_height?: number;
pixel_space?: number;
line_space?: number;
progress_cb?: ProgressCb;
offset?: number;
}
export type callback<T> = (err: Error, obj: T) => void
export type forEachCb<T> = (obj: T, idx: number) => boolean|void
export type mapCb<T,U> = (obj: T, index: number) => U
export type stats = {
min: number;
max: number;
mean: number;
std_dev: number;
}
export type units = {
units: string;
value: number;
}
export interface RasterReadableOptions extends stream.ReadableOptions {
blockOptimize?: boolean;
convertNoData?: boolean;
type?: new (len: number) => TypedArray;
}
export interface RasterTransformOptions extends stream.TransformOptions {
fn: Function;
type: new (len: number) => TypedArray;
}
export interface RasterWritableOptions extends stream.WritableOptions {
blockOptimize?: boolean;
convertNoData?: boolean;
}
export interface xyz {
x: number;
y: number;
z?: number;
}
/**
* Error level: Debug
*
* @final
* @constant
* @name CE_Debug
* @type {number}
*/
export const CE_Debug: number
/**
* Error level: Failure
*
* @final
* @constant
* @name CE_Failure
* @type {number}
*/
export const CE_Failure: number
/**
* Error level: Fatal
*
* @final
* @constant
* @name CE_Fatal
* @type {number}
*/
export const CE_Fatal: number
/**
* Error level: (no error)
*
* @final
* @constant
* @name CE_None
* @type {number}
*/
export const CE_None: number
/**
* Error level: Warning
*
* @final
* @constant
* @name CE_Warning
* @type {number}
*/
export const CE_Warning: number
/**
* @final
* @constant
* @name CPLE_AppDefined
* @type {number}
*/
export const CPLE_AppDefined: number
/**
* @final
* @constant
* @name CPLE_AssertionFailed
* @type {number}
*/
export const CPLE_AssertionFailed: number
/**
* @final
* @constant
* @name CPLE_FileIO
* @type {number}
*/
export const CPLE_FileIO: number
/**
* @final
* @constant
* @name CPLE_IllegalArg
* @type {number}
*/
export const CPLE_IllegalArg: number
/**
* @final
* @constant
* @name CPLE_NoWriteAccess
* @type {number}
*/
export const CPLE_NoWriteAccess: number
/**
* @final
* @constant
* @name CPLE_None
* @type {number}
*/
export const CPLE_None: number
/**
* @final
* @constant
* @name CPLE_NotSupported
* @type {number}
*/
export const CPLE_NotSupported: number
/**
* @final
* @constant
* @name CPLE_OpenFailed
* @type {number}
*/
export const CPLE_OpenFailed: number
/**
* @final
* @constant
* @name CPLE_OutOfMemory
* @type {number}
*/
export const CPLE_OutOfMemory: number
/**
* @final
* @constant
* @name CPLE_UserInterrupt
* @type {number}
*/
export const CPLE_UserInterrupt: number
/**
* @final
* @constant
* @name CPLE_objectNull
* @type {number}
*/
export const CPLE_objectNull: number
/**
* @final
* @constant
* @name DCAP_CREATE
* @type {string}
*/
export const DCAP_CREATE: string
/**
* @final
* @constant
* @name DCAP_CREATECOPY
* @type {string}
*/
export const DCAP_CREATECOPY: string
/**
* @final
* @constant
* @name DCAP_VIRTUALIO
* @type {string}
*/
export const DCAP_VIRTUALIO: string
/**
* @final
* @constant
* @name DIM_HORIZONTAL_X
* @type {string}
*/
export const DIM_HORIZONTAL_X: string
/**
* @final
* @constant
* @name DIM_HORIZONTAL_Y
* @type {string}
*/
export const DIM_HORIZONTAL_Y: string
/**
* @final
* @constant
* @name DIM_PARAMETRIC
* @type {string}
*/
export const DIM_PARAMETRIC: string
/**
* @final
* @constant
* @name DIM_TEMPORAL
* @type {string}
*/
export const DIM_TEMPORAL: string
/**
* @final
* @constant
* @name DIM_VERTICAL
* @type {string}
*/
export const DIM_VERTICAL: string
/**
* @final
* @constant
* @name DIR_DOWN
* @type {string}
*/
export const DIR_DOWN: string
/**
* @final
* @constant
* @name DIR_EAST
* @type {string}
*/
export const DIR_EAST: string
/**
* @final
* @constant
* @name DIR_FUTURE
* @type {string}
*/
export const DIR_FUTURE: string
/**
* @final
* @constant
* @name DIR_NORTH
* @type {string}
*/
export const DIR_NORTH: string
/**
* @final
* @constant
* @name DIR_PAST
* @type {string}
*/
export const DIR_PAST: string
/**
* @final
* @constant
* @name DIR_SOUTH
* @type {string}
*/
export const DIR_SOUTH: string
/**
* @final
* @constant
* @name DIR_UP
* @type {string}
*/
export const DIR_UP: string
/**
* @final
* @constant
* @name DIR_WEST
* @type {string}
*/
export const DIR_WEST: string
/**
* @final
* @constant
* @name DMD_CREATIONDATATYPES
* @type {string}
*/
export const DMD_CREATIONDATATYPES: string
/**
* @final
* @constant
* @name DMD_CREATIONOPTIONLIST
* @type {string}
*/
export const DMD_CREATIONOPTIONLIST: string
/**
* @final
* @constant
* @name DMD_EXTENSION
* @type {string}
*/
export const DMD_EXTENSION: string
/**
* @final
* @constant
* @name DMD_HELPTOPIC
* @type {string}
*/
export const DMD_HELPTOPIC: string
/**
* @final
* @constant
* @type {string}
* @name DMD_LONGNAME
*/
export const DMD_LONGNAME: string
/**
* @final
* @constant
* @name DMD_MIMETYPE
* @type {string}
*/
export const DMD_MIMETYPE: string
/**
* @final
* @constant
* @name GA_Readonly
* @type {number}
*/
export const GA_Readonly: number
/**
* @final
* @constant
* @name GA_Update
* @type {number}
*/
export const GA_Update: number
/**
* @final
* @constant
* @name GCI_AlphaBand
* @type {string}
*/
export const GCI_AlphaBand: string
/**
* @final
* @constant
* @name GCI_BlackBand
* @type {string}
*/
export const GCI_BlackBand: string
/**
* @final
* @constant
* @name GCI_BlueBand
* @type {string}
*/
export const GCI_BlueBand: string
/**
* @final
* @constant
* @name GCI_CyanBand
* @type {string}
*/
export const GCI_CyanBand: string
/**
* @final
* @constant
* @name GCI_GrayIndex
* @type {string}
*/
export const GCI_GrayIndex: string
/**
* @final
* @constant
* @name GCI_GreenBand
* @type {string}
*/
export const GCI_GreenBand: string
/**
* @final
* @constant
* @name GCI_HueBand
* @type {string}
*/
export const GCI_HueBand: string
/**
* @final
* @constant
* @name GCI_LightnessBand
* @type {string}
*/
export const GCI_LightnessBand: string
/**
* @final
* @constant
* @name GCI_MagentaBand
* @type {string}
*/
export const GCI_MagentaBand: string
/**
* @final
* @constant
* @name GCI_PaletteIndex
* @type {string}
*/
export const GCI_PaletteIndex: string
/**
* @final
* @constant
* @name GCI_RedBand
* @type {string}
*/
export const GCI_RedBand: string
/**
* @final
* @constant
* @name GCI_SaturationBand
* @type {string}
*/
export const GCI_SaturationBand: string
/**
* @final
* @constant
* @name GCI_Undefined
* @type {string}
*/
export const GCI_Undefined: string
/**
* @final
* @constant
* @name GCI_YCbCr_CbBand
* @type {string}
*/
export const GCI_YCbCr_CbBand: string
/**
* @final
* @constant
* @name GCI_YCbCr_CrBand
* @type {string}
*/
export const GCI_YCbCr_CrBand: string
/**
* @final
* @constant
* @name GCI_YCbCr_YBand
* @type {string}
*/
export const GCI_YCbCr_YBand: string
/**
* @final
* @constant
* @name GCI_YellowBand
* @type {string}
*/
export const GCI_YellowBand: string
/**
* Eight bit unsigned integer
* @final
* @constant
* @name GDT_Byte
* @type {string}
*/
export const GDT_Byte: string
/**
* Complex Float32
* @final
* @constant
* @name GDT_CFloat32
* @type {string}
*/
export const GDT_CFloat32: string
/**
* Complex Float64
* @final
* @constant
* @name GDT_CFloat64
* @type {string}
*/
export const GDT_CFloat64: string
/**
* Complex Int16
* @final
* @constant
* @name GDT_CInt16
* @type {string}
*/
export const GDT_CInt16: string
/**
* Complex Int32
* @final
* @constant
* @name GDT_CInt32
* @type {string}
*/
export const GDT_CInt32: string
/**
* Thirty two bit floating point
* @final
* @constant
* @name GDT_Float32
* @type {string}
*/
export const GDT_Float32: string
/**
* Sixty four bit floating point
* @final
* @constant
* @name GDT_Float64
* @type {string}
*/
export const GDT_Float64: string
/**
* Sixteen bit signed integer
* @final
* @constant
* @name GDT_Int16
* @type {string}
*/
export const GDT_Int16: string
/**
* Thirty two bit signed integer
* @final
* @constant
* @name GDT_Int32
* @type {string}
*/
export const GDT_Int32: string
/**
* Sixteen bit unsigned integer
* @final
* @constant
* @name GDT_UInt16
* @type {string}
*/
export const GDT_UInt16: string
/**
* Thirty two bit unsigned integer
* @final
* @constant
* @name GDT_UInt32
* @type {string}
*/
export const GDT_UInt32: string
/**
* Unknown or unspecified type
* @final
* @constant
* @name GDT_Unknown
* @type {string}
*/
export const GDT_Unknown: string
/**
* String extended type for MDArrays (GDAL >= 3.1)
* @final
* @constant
* @name GEDTC_Compound
* @type {string}
*/
export const GEDTC_Compound: string
/**
* String extended type for MDArrays (GDAL >= 3.1)
* @final
* @constant
* @name GEDTC_String
* @type {string}
*/
export const GEDTC_String: string
/**
* @final
* @constant
* @name GF_Read
* @type {number}
*/
export const GF_Read: number
/**
* @final
* @constant
* @name GF_Write
* @type {number}
*/
export const GF_Write: number
/**
* CMYK
* @final
* @constant
* @name GPI_CMYK
* @type {string}
*/
export const GPI_CMYK: string
/**
* Grayscale, only c1 defined
* @final
* @constant
* @name GPI_Gray
* @type {string}
*/
export const GPI_Gray: string
/**
* HLS, c4 is not defined
* @final
* @constant
* @name GPI_HLS
* @type {string}
*/
export const GPI_HLS: string
/**
* RGBA, alpha in c4
* @final
* @constant
* @name GPI_RGB
* @type {string}
*/
export const GPI_RGB: string
/**
* @final
* @constant
* @name GRA_Average
* @type {string}
*/
export const GRA_Average: string
/**
* @final
* @constant
* @name GRA_Bilinear
* @type {string}
*/
export const GRA_Bilinear: string
/**
* @final
* @constant
* @name GRA_Cubic
* @type {string}
*/
export const GRA_Cubic: string
/**
* @final
* @constant
* @name GRA_CubicSpline
* @type {string}
*/
export const GRA_CubicSpline: string
/**
* @final
* @constant
* @name GRA_Lanczos
* @type {string}
*/
export const GRA_Lanczos: string
/**
* @final
* @constant
* @name GRA_Mode
* @type {string}
*/
export const GRA_Mode: string
/**
* @final
* @constant
* @name GRA_NearestNeighbor
* @type {string}
*/
export const GRA_NearestNeighbor: string
/**
* @final
* @constant
* @name ODrCCreateDataSource
* @type {string}
*/
export const ODrCCreateDataSource: string
/**
* @final
* @constant
* @name ODrCDeleteDataSource
* @type {string}
*/
export const ODrCDeleteDataSource: string
/**
* @final
* @constant
* @name ODsCCreateGeomFieldAfterCreateLayer
* @type {string}
*/
export const ODsCCreateGeomFieldAfterCreateLayer: string
/**
* @final
* @constant
* @name ODsCCreateLayer
* @type {string}
*/
export const ODsCCreateLayer: string
/**
* @final
* @constant
* @name ODsCDeleteLayer
* @type {string}
*/
export const ODsCDeleteLayer: string
/**
* @final
* @constant
* @name OFTBinary
* @type {string}
*/
export const OFTBinary: string
/**
* @final
* @constant
* @name OFTDate
* @type {string}
*/
export const OFTDate: string
/**
* @final
* @constant
* @name OFTDateTime
* @type {string}
*/
export const OFTDateTime: string
/**
* @final
* @constant
* @name OFTInteger
* @type {string}
*/
export const OFTInteger: string
/**
* @final
* @constant
* @name OFTInteger64
* @type {string}
*/
export const OFTInteger64: string
/**
* @final
* @constant
* @name OFTInteger64List
* @type {string}
*/
export const OFTInteger64List: string
/**
* @final
* @constant
* @name OFTIntegerList
* @type {string}
*/
export const OFTIntegerList: string
/**
* @final
* @constant
* @name OFTReal
* @type {string}
*/
export const OFTReal: string
/**
* @final
* @constant
* @name OFTRealList
* @type {string}
*/
export const OFTRealList: string
/**
* @final
* @constant
* @name OFTString
* @type {string}
*/
export const OFTString: string
/**
* @final
* @constant
* @name OFTStringList
* @type {string}
*/
export const OFTStringList: string
/**
* @final
* @constant
* @name OFTTime
* @type {string}
*/
export const OFTTime: string
/**
* @final
* @constant
* @name OFTWideString
* @type {string}
*/
export const OFTWideString: string
/**
* @final
* @constant
* @name OFTWideStringList
* @type {string}
*/
export const OFTWideStringList: string
/**
* @final
* @constant
* @name OJLeft
* @type {string}
*/
export const OJLeft: string
/**
* @final
* @constant
* @name OJRight
* @type {string}
*/
export const OJRight: string
/**
* @final
* @constant
* @name OJUndefined
* @type {string}
*/
export const OJUndefined: string
/**
* @final
* @constant
* @name OLCAlterFieldDefn
* @type {string}
*/
export const OLCAlterFieldDefn: string
/**
* @final
* @constant
* @name OLCCreateField
* @type {string}
*/
export const OLCCreateField: string
/**
* @final
* @constant
* @name OLCCreateGeomField
* @type {string}
*/
export const OLCCreateGeomField: string
/**
* @final
* @constant
* @name OLCDeleteFeature
* @type {string}
*/
export const OLCDeleteFeature: string
/**
* @final
* @constant
* @name OLCDeleteField
* @type {string}
*/
export const OLCDeleteField: string
/**
* @final
* @constant
* @name OLCFastFeatureCount
* @type {string}
*/
export const OLCFastFeatureCount: string
/**
* @final
* @constant
* @name OLCFastGetExtent
* @type {string}
*/
export const OLCFastGetExtent: string
/**
* @final
* @constant
* @name OLCFastSetNextByIndex
* @type {string}
*/
export const OLCFastSetNextByIndex: string
/**
* @final
* @constant
* @name OLCFastSpatialFilter
* @type {string}
*/
export const OLCFastSpatialFilter: string
/**
* @final
* @constant
* @name OLCIgnoreFields
* @type {string}
*/
export const OLCIgnoreFields: string
/**
* @final
* @constant
* @name OLCRandomRead
* @type {string}
*/
export const OLCRandomRead: string
/**
* @final
* @constant
* @name OLCRandomWrite
* @type {string}
*/
export const OLCRandomWrite: string
/**
* @final
* @constant
* @name OLCReorderFields
* @type {string}
*/
export const OLCReorderFields: string
/**
* @final
* @constant
* @name OLCSequentialWrite
* @type {string}
*/
export const OLCSequentialWrite: string
/**
* @final
* @constant
* @name OLCStringsAsUTF8
* @type {string}
*/
export const OLCStringsAsUTF8: string
/**
* @final
* @constant
* @name OLCTransactions
* @type {string}
*/
export const OLCTransactions: string
/**
* GDAL library - system library (false) or bundled (true)
*
* @final
* @constant {boolean} bundled
*/
export const bundled: boolean
/**
* The collection of all drivers registered with GDAL
*
* @readonly
* @static
* @constant
* @name drivers
* @type {GDALDrivers}
*/
export const drivers: GDALDrivers
/**
* Should a warning be emitted to stderr when a synchronous operation
* is blocking the event loop, can be safely disabled unless
* the user application needs to remain responsive at all times
* Use `(gdal as any).eventLoopWarning = false` to set the value from TypeScript
*
* @var {boolean} eventLoopWarning
*/
export let eventLoopWarning: unknown
/**
* Details about the last error that occurred. The property
* will be null or an object containing three properties: "number",
* "message", and "type".
*
* @var {object} lastError
*/
export let lastError: unknown
/**
* GDAL version (not the binding version)
*
* @final
* @constant {string} version
*/
export const version: string
/**
* @final
*
* The `wkb25DBit` constant can be used to convert between 2D types to 2.5D
* types
*
* @example
*
* // 2 -> 2.5D
* wkbPoint25D = gdal.wkbPoint | gdal.wkb25DBit
*
* // 2.5D -> 2D (same as wkbFlatten())
* wkbPoint = gdal.wkbPoint25D & (~gdal.wkb25DBit)
*
* @constant
* @name wkb25DBit
* @type {number}
*/
export const wkb25DBit: number
/**
* @final
* @constant
* @name wkbCircularString
* @type {number}
*/
export const wkbCircularString: number
/**
* @final
* @constant
* @name wkbCompoundCurve
* @type {number}
*/
export const wkbCompoundCurve: number
/**
* @final
* @constant
* @name wkbGeometryCollection
* @type {number}
*/
export const wkbGeometryCollection: number
/**
* @final
* @constant
* @name wkbGeometryCollection25D
* @type {number}
*/
export const wkbGeometryCollection25D: number
/**
* @final
* @constant
* @name wkbLineString
* @type {number}
*/
export const wkbLineString: number
/**
* @final
* @constant
* @name wkbLineString25D
* @type {number}
*/
export const wkbLineString25D: number
/**
* @final
* @constant
* @name wkbLinearRing
* @type {string}
*/
export const wkbLinearRing: string
/**
* @final
* @constant
* @name wkbLinearRing25D
* @type {number}
*/
export const wkbLinearRing25D: number
/**
* @final
* @constant
* @name wkbMultiCurve
* @type {number}
*/
export const wkbMultiCurve: number
/**
* @final
* @constant
* @name wkbMultiLineString
* @type {number}
*/
export const wkbMultiLineString: number
/**
* @final
* @constant
* @name wkbMultiLineString25D
* @type {number}
*/
export const wkbMultiLineString25D: number
/**
* @final
* @constant
* @name wkbMultiPoint
* @type {number}
*/
export const wkbMultiPoint: number
/**
* @final
* @constant
* @name wkbMultiPoint25D
* @type {number}
*/
export const wkbMultiPoint25D: number
/**
* @final
* @constant
* @name wkbMultiPolygon
* @type {number}
*/
export const wkbMultiPolygon: number
/**
* @final
* @constant
* @name wkbMultiPolygon25D
* @type {number}
*/
export const wkbMultiPolygon25D: number
/**
* @final
* @constant
* @name wkbNDR
* @type {string}
*/
export const wkbNDR: string
/**
* @final
* @constant
* @name wkbNone
* @type {number}
*/
export const wkbNone: number
/**
* @final
* @constant
* @name wkbPoint
* @type {number}
*/
export const wkbPoint: number
/**
* @final
* @constant
* @name wkbPoint25D
* @type {number}
*/
export const wkbPoint25D: number
/**
* @final
* @constant
* @name wkbPolygon
* @type {number}
*/
export const wkbPolygon: number
/**
* @final
* @constant
* @name wkbPolygon25D
* @type {number}
*/
export const wkbPolygon25D: number
/**
* @final
* @constant
* @name wkbUnknown
* @type {number}
*/
export const wkbUnknown: number
/**
* SFSQL 1.2 and ISO SQL/MM Part 3 extended dimension (Z&M) WKB types.
*
* @final
* @constant
* @name wkbVariantIso
* @type {string}
*/
export const wkbVariantIso: string
/**
* Old-style 99-402 extended dimension (Z) WKB types.
* Synonymous with 'wkbVariantOldOgc' (gdal >= 2.0)
*
* @final
* @constant
* @name wkbVariantOgc
* @type {string}
*/
export const wkbVariantOgc: string
/**
* Old-style 99-402 extended dimension (Z) WKB types.
* Synonymous with 'wkbVariantOgc' (gdal < 2.0)
*
* @final
* @constant
* @name wkbVariantOldOgc
* @type {string}
*/
export const wkbVariantOldOgc: string
/**
* @final
* @constant
* @name wkbXDR
* @type {string}
*/
export const wkbXDR: string
/**
* Register a new compiled pixel function for derived virtual datasets.
*
* This method is not meant to be used directly by the end user,
* it is an entry point for plugins implementing pixel functions.
*
* You can check the `gdal-exprtk` plugin for an implementation
* which uses ExprTk expressions.
*
* @throws {Error}
* @method addPixelFunc
* @static
* @param {string} name
* @param {PixelFunction} pixelFn
*/
export function addPixelFunc(name: string, pixelFn: PixelFunction): void
/**
* Library version of gdalbuildvrt.
*
* @example
* const ds1 = gdal.buildVRT('/vsimem/target.tiff',
* [ 'input1.tif', 'input2.tif' ],
* [ '-resolution', 'highest' ] );
*
* const ds2 = gdal.buildVRT('/vsimem/target.tiff',
* [ gdal.open('input1.tif'), gdal.open('input2.tif') ],
* [ '-resolution', 'highest' ] );
*
* @throws {Error}
* @method buildVRT
* @static
* @param {string|null} dst_path destination path, null for an in-memory operation
* @param {Dataset[]|string[]} src_ds array of source datasets
* @param {string[]} [args] array of CLI options for gdalbuildvrt
* @param {UtilOptions} [options] additional options
* @param {ProgressCb} [options.progress_cb]
* @return {Dataset}
*/
export function buildVRT(dst_path: string|null, src_ds: Dataset[]|string[], args?: string[], options?: UtilOptions): Dataset
/**
* Library version of gdalbuildvrt.
* @async
*
* @example
* const ds1 = await gdal.buildVRTAsync('/vsimem/target.tiff',
* [ 'input1.tif', 'input2.tif' ],
* [ '-resolution', 'highest' ] );
*
* const ds2 = gdal.buildVRT('/vsimem/target.tiff',
* [ await gdal.openAsync('input1.tif'), await gdal.openAsync('input2.tif') ],
* [ '-resolution', 'highest' ] );
*
* @throws {Error}
*
* @method buildVRTAsync
* @static
* @param {string|null} dst_path destination path, null for an in-memory operation
* @param {Dataset[]|string[]} src_ds array of source datasets
* @param {string[]} [args] array of CLI options for gdalbuildvrt
* @param {UtilOptions} [options] additional options
* @param {ProgressCb} [options.progress_cb]
* @param {callback<Dataset>} [callback=undefined]
* @return {Promise<Dataset>}
*/
export function buildVRTAsync(dst_path: string|null, src_ds: Dataset[]|string[], args?: string[], options?: UtilOptions, callback?: callback<Dataset>): Promise<Dataset>
/**
* Compute a new output band as a pixel-wise function of given input bands
*
* This is an alternative implementation of `gdal_calc.py`
*
* It is fully async and reading and decoding of input and output bands happen
* in separate background threads for each band as long as they are in separate datasets.
*
* The main bottleneck is the passed function `fn` which must always run on the main Node.js/V8 thread.
* This is a fundamental Node.js/V8 limitation that is impossible to overcome.
*
* This function is not to be used in server code that must remain responsive at all times.
* It does not directly block the event loop, but it is very CPU-heavy and cannot
* run parallel to other instances of itself. If multiple instances run in parallel, they
* will all compete for the main thread, executing `fn` on the incoming data chunks on turn by turn basis.
*
* It internally uses a {@link RasterTransform} which can also be used directly for
* a finer-grained control over the transformation.
*
* You can check the `gdal-exprtk` plugin for an alternative implementation which uses
* an ExprTk expression instead of a JS function and performs only O(1) operations on the main thread
*
* There is no sync version
*
* @function calcAsync
* @param {Record<string, RasterBand>} inputs An object containing all the input bands
* @param {RasterBand} output Output raster band
* @param {(...args: number[]) => number} fn Function to apply on all pixels, it must have the same number of arguments as there are input bands
* @param {CalcOptions} [options] Options
* @param {boolean} [options.convertNoData=false] Input bands will have their NoData pixels converted to NaN and a NaN output value of the given function will be converted to a NoData pixel, provided that the output raster band has its `RasterBand.noDataValue` set
* @param {boolean} [options.convertInput=false] Input bands will have their pixels converted to the output data type before calling the user-supplied function, can be used to allow integer data types to get their NoData converted to `NaN`
* @param {ProgressCb} [options.progress_cb=undefined] Progress callback
* @return {Promise<void>}
* @static
*
* @example
*
* const T2m = await gdal.openAsync('TEMP_2M.tiff'));
* const D2m = await gdal.openAsync('DEWPOINT_2M.tiff'));
* const size = await T2m.rasterSizeAsync
* const cloudBase = await gdal.openAsync('CLOUDBASE.tiff', 'w', 'GTiff',
* size.x, size.y, 1, gdal.GDT_Float64);
*
* (await cloudBase.bands.getAsync(1)).noDataValue = -1e38
* // Espy's estimation for cloud base height
* const espyFn = (t, td) => 125 * (t - td);
*
* await calcAsync({
* t: await T2m.bands.getAsync(1),
* td: await D2m.bands.getAsync(1)
* }, cloudBase.bands.getAsync(1), espyFn, { convertNoData: true });
*/
export function calcAsync(inputs: Record<string, RasterBand>, output: RasterBand, fn: (...args: number[]) => number, options?: CalcOptions): Promise<void>
/**
* Compute checksum for image region.
*
* @throws {Error}
* @method checksumImage
* @static
* @param {RasterBand} src
* @param {number} [x=0]
* @param {number} [y=0]
* @param {number} [w=src.width]
* @param {number} [h=src.height]
* @return {number}
*/
export function checksumImage(src: RasterBand, x?: number, y?: number, w?: number, h?: number): number
/**
* Compute checksum for image region.
*
* @throws {Error}
* @method checksumImageAsync
* @static
* @param {RasterBand} src
* @param {number} [x=0]
* @param {number} [y=0]
* @param {number} [w=src.width]
* @param {number} [h=src.height]
* @param {callback<number>} [callback=undefined]
* @return {number}
* @return {Promise<number>}
*/
export function checksumImageAsync(src: RasterBand, x?: number, y?: number, w?: number, h?: number, callback?: callback<number>): Promise<number>
/**
* Create vector contours from raster DEM.
*
* This algorithm will generate contour vectors for the input raster band on the
* requested set of contour levels. The vector contours are written to the
* passed in vector layer. Also, a NODATA value may be specified to identify
* pixels that should not be considered in contour line generation.
*
* @throws {Error}
* @method contourGenerate
* @static
* @param {ContourOptions} options
* @param {RasterBand} options.src
* @param {Layer} options.dst
* @param {number} [options.offset=0] The "offset" relative to which contour intervals are applied. This is normally zero, but could be different. To generate 10m contours at 5, 15, 25, ... the offset would be 5.
* @param {number} [options.interval=100] The elevation interval between contours generated.
* @param {number[]} [options.fixedLevels] A list of fixed contour levels at which contours should be generated. Overrides interval/base options if set.
* @param {number} [options.nodata] The value to use as a "nodata" value. That is, a pixel value which should be ignored in generating contours as if the value of the pixel were not known.
* @param {number} [options.idField] A field index to indicate where a unique id should be written for each feature (contour) written.
* @param {number} [options.elevField] A field index to indicate where the elevation value of the contour should be written.
* @param {ProgressCb} [options.progress_cb]
*/
export function contourGenerate(options: ContourOptions): void
/**
* Create vector contours from raster DEM.
* @async
*
* This algorithm will generate contour vectors for the input raster band on the
* requested set of contour levels. The vector contours are written to the
* passed in vector layer. Also, a NODATA value may be specified to identify
* pixels that should not be considered in contour line generation.
*
* @throws {Error}
* @method contourGenerateAsync
* @static
* @param {ContourOptions} options
* @param {RasterBand} options.src
* @param {Layer} options.dst
* @param {number} [options.offset=0] The "offset" relative to which contour intervals are applied. This is normally zero, but could be different. To generate 10m contours at 5, 15, 25, ... the offset would be 5.
* @param {number} [options.interval=100] The elevation interval between contours generated.
* @param {number[]} [options.fixedLevels] A list of fixed contour levels at which contours should be generated. Overrides interval/base options if set.
* @param {number} [options.nodata] The value to use as a "nodata" value. That is, a pixel value which should be ignored in generating contours as if the value of the pixel were not known.
* @param {number} [options.idField] A field index to indicate where a unique id should be written for each feature (contour) written.
* @param {number} [options.elevField] A field index to indicate where the elevation value of the contour should be written.
* @param {ProgressCb} [options.progress_cb]
* @param {callback<void>} [callback=undefined]
* @return {Promise<void>}
*/
export function contourGenerateAsync(options: ContourOptions, callback?: callback<void>): Promise<void>
/**
* Create a GDAL pixel function from a JS expression for one pixel.
*
* Higher-level API of `gdal.toPixelFunc`.
*
* @static
* @method createPixelFunc
*
* @example
* // This example will register a new GDAL pixel function called sum2
* // that requires a VRT dataset with 2 values per pixel
* gdal.addPixelFunc('sum2', gdal.createPixelFunc((a, b) => a + b));
*
* @param {(...sources: number[]) => void} pixelFn
* @returns {PixelFunction}
*/
export function createPixelFunc(pixelFn: (...sources: number[]) => void): PixelFunction
/**
* Create a GDAL pixel function from a JS expression for one pixel.
*
* Same as `gdal.createPixelFunc` but passes an object with the static arguments from
* the VRT descriptor.
*
* @static
* @method createPixelFuncWithArgs
*
* @example
* // This example will register a new GDAL pixel function called sum2
* // that requires a VRT dataset with 2 values per pixel
* gdal.addPixelFunc('sum2', gdal.createPixelFuncWithArgs((args, a, b) => args.k + a + b));
*
* @param {(args: Record<string, string|number>,...sources: number[]) => void} pixelFn
* @returns {PixelFunction}
*/
export function createPixelFuncWithArgs(pixelFn: (args: Record<string, string|number>,...sources: number[]) => void): PixelFunction
/**
* Convert decimal degrees to degrees, minutes, and seconds string.
*
* @static
* @method decToDMS
* @param {number} angle
* @param {string} axis `"lat"` or `"long"`
* @param {number} [precision=2]
* @return {string} A string nndnn'nn.nn'"L where n is a number and L is either
* N or E
*/
export function decToDMS(angle: number, axis: string, precision?: number): string
/**
* Library version of gdaldem.
*
* @example
* const ds = gdal.open('input.tif')
* const output = gdal.dem('/vsimem/output.tiff', ds, 'hillshade', [ '-z', '2' ])
*
* @throws {Error}
* @method dem
* @static
* @param {string} dst_path destination path
* @param {Dataset} src_ds source dataset
* @param {'hillshade'|'slope'|'aspect'|'color-relief'|'TRI'|'TPI'|'Roughness'} mode processing mode
* @param {string[]} [args] array of CLI options for gdaldem
* @param {string} [colorFile] optional color filename, see https://gdal.org/programs/gdaldem.html for more details
* @param {UtilOptions} [options] additional options
* @param {ProgressCb} [options.progress_cb]
* @return {Dataset}
*/
export function dem(dst_path: string, src_ds: Dataset, mode: 'hillshade'|'slope'|'aspect'|'color-relief'|'TRI'|'TPI'|'Roughness', args?: string[], colorFile?: string, options?: UtilOptions): Dataset
/**
* Library version of gdaldem.
* @async
*
* @example
* const ds = await gdal.openAsync('input.tif')
* const output = await gdal.demAsync('/vsimem/output.tiff', ds, 'hillshade', [ '-z', '2' ])
*
* @throws {Error}
* @method demAsync
* @static
* @param {string} dst_path destination path
* @param {Dataset} src_ds source dataset
* @param {'hillshade'|'slope'|'aspect'|'color-relief'|'TRI'|'TPI'|'Roughness'} mode processing mode
* @param {string[]} [args] array of CLI options for gdaldem
* @param {string} [colorFile] optional color filename, see https://gdal.org/programs/gdaldem.html for more details
* @param {UtilOptions} [options] additional options
* @param {ProgressCb} [options.progress_cb]
* @param {callback<Dataset>} [callback=undefined]
* @return {Promise<Dataset>}
*/
export function demAsync(dst_path: string, src_ds: Dataset, mode: 'hillshade'|'slope'|'aspect'|'color-relief'|'TRI'|'TPI'|'Roughness', args?: string[], colorFile?: string, options?: UtilOptions, callback?: callback<Dataset>): Promise<Dataset>
/**
* Fill raster regions by interpolation from edges.
*
* @throws {Error}
* @method fillNodata
* @static
* @param {FillOptions} options
* @param {RasterBand} options.src This band to be updated in-place.
* @param {RasterBand} [options.mask] Mask band
* @param {number} options.searchDist The maximum distance (in pixels) that the algorithm will search out for values to interpolate.
* @param {number} [options.smoothingIterations=0] The number of 3x3 average filter smoothing iterations to run after the interpolation to dampen artifacts.
*/
export function fillNodata(options: FillOptions): void
/**
* Fill raster regions by interpolation from edges.
* @async
*
* @throws {Error}
* @method fillNodataAsync
* @static
* @param {FillOptions} options
* @param {RasterBand} options.src This band to be updated in-place.
* @param {RasterBand} [options.mask] Mask band
* @param {number} options.searchDist The maximum distance (in pixels) that the algorithm will search out for values to interpolate.
* @param {number} [options.smoothingIterations=0] The number of 3x3 average filter smoothing iterations to run after the interpolation to dampen artifacts.
* @param {callback<void>} [callback=undefined]
* @return {Promise<void>}
*/
export function fillNodataAsync(options: FillOptions, callback?: callback<void>): Promise<void>
/**
* Returns a `TypedArray` constructor from a GDAL data type
*
* @example
*
* const array = new (gdal.fromDataType(band.dataType))(band.size.x * band.size.y)
* `
*
* @method fromDataType
* @throws TypeError
* @param {string|null} dataType
* @return {new (len: number) => TypedArray}
*/
export function fromDataType(dataType: string|null): new (len: number) => TypedArray
/**
* Library version of gdalinfo.
*
* @example
* const ds = gdal.open('input.tif')
* const output = gdal.info('/vsimem/temp.tif')
*
* @throws {Error}
* @method info
* @static
* @param {Dataset} dataset
* @param {string[]} [args] array of CLI options for gdalinfo
* @return {string}
*/
export function info(dataset: Dataset, args?: string[]): string
/**
* Library version of gdalinfo.
* @async
*
* @example
* const ds = gdal.open('input.tif')
* const output = gdal.info('/vsimem/temp.tif')
* @throws {Error}
*
* @method infoAsync
* @static
* @param {Dataset} dataset
* @param {string[]} [args] array of CLI options for gdalinfo
* @param {callback<string>} [callback=undefined]
* @return {Promise<string>}
*/
export function infoAsync(dataset: Dataset, args?: string[], callback?: callback<string>): Promise<string>
/**
* Creates or opens a dataset. Dataset should be explicitly closed with `dataset.close()` method if opened in `"w"` mode to flush any changes. Otherwise, datasets are closed when (and if) node decides to garbage collect them.
*
* @example
*
* var dataset = gdal.open('./data.shp');
*
* @example
*
* var dataset = gdal.open(fs.readFileSync('./data.shp'));
*
* @throws Error
* @method open
* @static
* @param {string|Buffer} path Path to dataset or in-memory Buffer to open
* @param {string} [mode="r"] The mode to use to open the file: `"r"`, `"r+"`, or `"w"`
* @param {string|string[]} [drivers] Driver name, or list of driver names to attempt to use.
*
* @param {number} [x_size] Used when creating a raster dataset with the `"w"` mode.
* @param {number} [y_size] Used when creating a raster dataset with the `"w"` mode.
* @param {number} [band_count] Used when creating a raster dataset with the `"w"` mode.
* @param {string} [data_type] Used when creating a raster dataset with the `"w"` mode.
* @param {string[]|object} [creation_options] Used when creating a dataset with the `"w"` mode.
*
* @return {Dataset}
*/
export function open(path: string|Buffer, mode?: string, drivers?: string|string[], x_size?: number, y_size?: number, band_count?: number, data_type?: string, creation_options?: string[]|object): Dataset
/**
* TypeScript shorthand version with callback and no optional arguments
*
* @method openAsync
* @static
* @param {string|Buffer} path Path to dataset or in-memory Buffer to open
* @param {callback<Dataset>} callback
* @return {void}
*/
export function openAsync(path: string|Buffer, callback: callback<Dataset>): void
/**
* Asynchronously creates or opens a dataset. Dataset should be explicitly closed with `dataset.close()` method if opened in `"w"` mode to flush any changes. Otherwise, datasets are closed when (and if) node decides to garbage collect them.
* If the last parameter is a callback, then this callback is called on completion and undefined is returned. Otherwise the function returns a Promise resolved with the result.
*
* @example
*
* var dataset = await gdal.openAsync('./data.shp');
*
* @example
*
* var dataset = await gdal.openAsync(await fd.readFile('./data.shp'));
*
* @example
*
* gdal.openAsync('./data.shp', (err, ds) => {...});
*
* @method openAsync
* @static
* @param {string|Buffer} path Path to dataset or in-memory Buffer to open
* @param {string} [mode="r"] The mode to use to open the file: `"r"`, `"r+"`, or `"w"`
* @param {string|string[]} [drivers] Driver name, or list of driver names to attempt to use.
*
* @param {number} [x_size] Used when creating a raster dataset with the `"w"` mode.
* @param {number} [y_size] Used when creating a raster dataset with the `"w"` mode.
* @param {number} [band_count] Used when creating a raster dataset with the `"w"` mode.
* @param {string} [data_type] Used when creating a raster dataset with the `"w"` mode.
* @param {string[]|object} [creation_options] Used when creating a dataset with the `"w"` mode.
* @param {callback<Dataset>} [callback=undefined]
* @return {Promise<Dataset>}
*/
export function openAsync(path: string|Buffer, mode?: string, drivers?: string|string[], x_size?: number, y_size?: number, band_count?: number, data_type?: string, creation_options?: string[]|object, callback?: callback<Dataset>): Promise<Dataset>
/**
* Creates vector polygons for all connected regions of pixels in the raster
* sharing a common pixel value. Each polygon is created with an attribute
* indicating the pixel value of that polygon. A raster mask may also be
* provided to determine which pixels are eligible for processing.
*
* @throws {Error}
* @method polygonize
* @static
* @param {PolygonizeOptions} options
* @param {RasterBand} options.src
* @param {Layer} options.dst
* @param {RasterBand} [options.mask]
* @param {number} options.pixValField The attribute field index indicating the feature attribute into which the pixel value of the polygon should be written.
* @param {number} [options.connectedness=4] Either 4 indicating that diagonal pixels are not considered directly adjacent for polygon membership purposes or 8 indicating they are.
* @param {boolean} [options.useFloats=false] Use floating point buffers instead of int buffers.
* @param {ProgressCb} [options.progress_cb]
*/
export function polygonize(options: PolygonizeOptions): void
/**
* Creates vector polygons for all connected regions of pixels in the raster
* sharing a common pixel value. Each polygon is created with an attribute
* indicating the pixel value of that polygon. A raster mask may also be
* provided to determine which pixels are eligible for processing.
* @async
*
* @throws {Error}
* @method polygonizeAsync
* @static
* @param {PolygonizeOptions} options
* @param {RasterBand} options.src
* @param {Layer} options.dst
* @param {RasterBand} [options.mask]
* @param {number} options.pixValField The attribute field index indicating the feature attribute into which the pixel value of the polygon should be written.
* @param {number} [options.connectedness=4] Either 4 indicating that diagonal pixels are not considered directly adjacent for polygon membership purposes or 8 indicating they are.
* @param {boolean} [options.useFloats=false] Use floating point buffers instead of int buffers.
* @param {ProgressCb} [options.progress_cb]
* @param {callback<void>} [callback=undefined]
* @return {Promise<void>}
*/
export function polygonizeAsync(options: PolygonizeOptions, callback?: callback<void>): Promise<void>
/**
* Disables all output.
*
* @static
* @method quiet
*/
export function quiet(): void
/**
* Library version of gdal_rasterize.
*
* @example
* const ds1 = gdal.rasterize('/vsimem/target.tiff',
* src_ds,
* [ '-b', '1' ] );
*
* const ds2 = gdal.rasterize(dst_ds,
* src_ds,
* [ '-b', '1' ] );
*
* @throws {Error}
* @method rasterize
* @static
* @param {string|Dataset} destination
* @param {Dataset} source dataset
* @param {string[]} [args] array of CLI options for gdal_rasterize
* @param {UtilOptions} [options] additional options
* @param {ProgressCb} [options.progress_cb]
* @return {Dataset}
*/
export function rasterize(destination: string|Dataset, source: Dataset, args?: string[], options?: UtilOptions): Dataset
/**
* Library version of gdal_rasterize.
* @async
*
* @example
* const ds1 = await gdal.rasterizeAsync('/vsimem/target.tiff',
* src_ds,
* [ '-b', '1' ] );
*
* const ds2 = await gdal.rasterizeAsync(dst_ds,
* src_ds,
* [ '-b', '1' ] );
*
* @throws {Error}
* @method rasterizeAsync
* @static
* @param {string|Dataset} destination
* @param {Dataset} source dataset
* @param {string[]} [args] array of CLI options for gdal_rasterize
* @param {UtilOptions} [options] additional options
* @param {ProgressCb} [options.progress_cb]
* @param {callback<Dataset>} [callback=undefined]
* @return {Promise<Dataset>}
*/
export function rasterizeAsync(destination: string|Dataset, source: Dataset, args?: string[], options?: UtilOptions, callback?: callback<Dataset>): Promise<Dataset>
/**
* Reprojects a dataset.
*
* @throws {Error}
* @method reprojectImage
* @static
* @param {ReprojectOptions} options
* @param {Dataset} options.src
* @param {Dataset} options.dst
* @param {SpatialReference} options.s_srs
* @param {SpatialReference} options.t_srs
* @param {string} [options.resampling] Resampling algorithm ({@link GRA|available options})
* @param {Geometry} [options.cutline] Must be in src dataset pixel coordinates. Use CoordinateTransformation to convert between georeferenced coordinates and pixel coordinates
* @param {number[]} [options.srcBands]
* @param {number[]} [options.dstBands]
* @param {number} [options.srcAlphaBand]
* @param {number} [options.dstAlphaBand]
* @param {number} [options.srcNodata]
* @param {number} [options.dstNodata]
* @param {number} [options.memoryLimit]
* @param {number} [options.maxError]
* @param {boolean} [options.multi]
* @param {string[]|object} [options.options] Warp options (see: [reference](https://gdal.org/doxygen/structGDALWarpOptions.html))
* @param {ProgressCb} [options.progress_cb]
*/
export function reprojectImage(options: ReprojectOptions): void
/**
* Reprojects a dataset.
* @async
*
* @throws {Error}
* @method reprojectImageAsync
* @static
* @param {ReprojectOptions} options
* @param {Dataset} options.src
* @param {Dataset} options.dst
* @param {SpatialReference} options.s_srs
* @param {SpatialReference} options.t_srs
* @param {string} [options.resampling] Resampling algorithm ({@link GRA|available options})
* @param {Geometry} [options.cutline] Must be in src dataset pixel coordinates. Use CoordinateTransformation to convert between georeferenced coordinates and pixel coordinates
* @param {number[]} [options.srcBands]
* @param {number[]} [options.dstBands]
* @param {number} [options.srcAlphaBand]
* @param {number} [options.dstAlphaBand]
* @param {number} [options.srcNodata]
* @param {number} [options.dstNodata]
* @param {number} [options.memoryLimit]
* @param {number} [options.maxError]
* @param {boolean} [options.multi]
* @param {string[]|object} [options.options] Warp options (see:[reference](https://gdal.org/doxygen/structGDALWarpOptions.html)
* @param {ProgressCb} [options.progress_cb]
* @param {callback<void>} [callback=undefined]
* @return {Promise<void>}
*/
export function reprojectImageAsync(options: ReprojectOptions, callback?: callback<void>): Promise<void>
/**
* Set paths where pro