gdal
This node-gdal-async binding for Node.js provides a feature-complete way of reading, writing, and manipulating geospatial data, raster and vector, synchronously and asynchronously using GDAL .
See
ASYNCIO.md
for some performance considerations when designing code
that will run multiple parallel operations on the same dataset.
Major Objects
Classes for GDAL Major Objects
function open() lib/gdal.js
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.
Parameter | Type | Description |
---|---|---|
path |
string
| Buffer
|
Path to dataset or in-memory Buffer to open |
mode |
string
|
The mode to use to open the file:
|
drivers |
string
| Array
<
string
>
| undefined
|
Driver name, or list of driver names to attempt to use. |
x_size |
number
| undefined
|
Used when creating a raster dataset with the
|
y_size |
number
| undefined
|
Used when creating a raster dataset with the
|
band_count |
number
| undefined
|
Used when creating a raster dataset with the
|
data_type |
string
| undefined
|
Used when creating a raster dataset with the
|
creation_options |
Array
<
string
>
| object
| undefined
|
Used when creating a dataset with the
|
Error
var dataset = gdal.open('./data.shp');
var dataset = gdal.open(fs.readFileSync('./data.shp'));
function openAsync() lib/gdal.js
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.
Parameter | Type | Description |
---|---|---|
path |
string
| Buffer
|
Path to dataset or in-memory Buffer to open |
mode |
string
|
The mode to use to open the file:
|
drivers |
string
| Array
<
string
>
| undefined
|
Driver name, or list of driver names to attempt to use. |
x_size |
number
| undefined
|
Used when creating a raster dataset with the
|
y_size |
number
| undefined
|
Used when creating a raster dataset with the
|
band_count |
number
| undefined
|
Used when creating a raster dataset with the
|
data_type |
string
| undefined
|
Used when creating a raster dataset with the
|
creation_options |
Array
<
string
>
| object
| undefined
|
Used when creating a dataset with the
|
callback |
callback
<
Dataset
>
|
var dataset = await gdal.openAsync('./data.shp');
var dataset = await gdal.openAsync(await fd.readFile('./data.shp'));
gdal.openAsync('./data.shp', (err, ds) => {...});
function openAsync() lib/gdal.js
TypeScript shorthand version with callback and no optional arguments
Parameter | Type | Description |
---|---|---|
path |
string
| Buffer
|
Path to dataset or in-memory Buffer to open |
callback |
callback
<
Dataset
>
|
void
class Dataset src/gdal_dataset.cpp
A set of associated raster bands and/or vector layers, usually from one file.
Example// raster dataset:
dataset = gdal.open('file.tif');
bands = dataset.bands;
// vector dataset:
dataset = gdal.open('file.shp');
layers = dataset.layers;
bands : DatasetBands src/gdal_dataset.cpp
description : string src/gdal_dataset.cpp
driver : Driver src/gdal_dataset.cpp
geoTransform : Array < number > | null src/gdal_dataset.cpp
An affine transform which maps pixel/line coordinates into georeferenced space using the following relationship:
Examplevar GT = dataset.geoTransform;
var Xgeo = GT[0] + Xpixel*GT[1] + Yline*GT[2];
var Ygeo = GT[3] + Xpixel*GT[4] + Yline*GT[5];
geoTransformAsync : Promise < Array < number > | null > src/gdal_dataset.cpp
An affine transform which maps pixel/line coordinates into georeferenced space using the following relationship:
Asynchronous read-only getter. Returns a Promise that resolves with the result.
Examplevar GT = dataset.geoTransform;
var Xgeo = GT[0] + Xpixel*GT[1] + Yline*GT[2];
var Ygeo = GT[3] + Xpixel*GT[4] + Yline*GT[5];
layers : DatasetLayers src/gdal_dataset.cpp
rasterSize : xyz src/gdal_dataset.cpp
rasterSizeAsync : Promise < xyz > src/gdal_dataset.cpp
Raster dimensions. An object containing
x
and
y
properties.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
root : Group src/gdal_dataset.cpp
srs : SpatialReference | null src/gdal_dataset.cpp
Spatial reference associated with raster dataset.
ThrowssrsAsync : Promise < SpatialReference | null > src/gdal_dataset.cpp
Spatial reference associated with raster dataset.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
Throwsfunction buildOverviews() src/gdal_dataset.cpp
Builds dataset overviews.
Parameter | Type | Description |
---|---|---|
resampling |
string
|
|
overviews |
Array
<
number
>
|
|
bands |
Array
<
number
>
| undefined
|
Note: Generation of overviews in external TIFF currently only supported when operating on all bands. |
options |
ProgressOptions
| undefined
|
options |
function buildOverviewsAsync() src/gdal_dataset.cpp
Builds dataset overviews.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
resampling |
string
|
|
overviews |
Array
<
number
>
|
|
bands |
Array
<
number
>
| undefined
|
Note: Generation of overviews in external TIFF currently only supported when operating on all bands. |
options |
ProgressOptions
| undefined
|
options |
callback |
callback
<
void
>
|
Promise
<
void
>
function close() src/gdal_dataset.cpp
Closes the dataset to further operations. It releases all memory and ressources held by the dataset.
This is normally an instantenous atomic operation that won't block the event loop except if there is an operation running on this dataset in asynchronous context - in this case this call will block until that operation finishes.
If this could potentially be the case and blocking the event loop is not possible (server code), then the best option is to simply dereference it (ds = null) and leave the garbage collector to expire it.
Implementing an asynchronous delete is difficult since all V8 object creation/deletion must take place on the main thread.
flush()/flushAsync() ensure that, when writing, all data has been written.
function executeSQL() src/gdal_dataset.cpp
Execute an SQL statement against the data store.
Parameter | Type | Description |
---|---|---|
statement |
string
|
SQL statement to execute. |
spatial_filter |
Geometry
|
Geometry which represents a spatial filter. |
dialect |
string
|
Allows control of the statement dialect. If
set to
|
function executeSQLAsync() src/gdal_dataset.cpp
Execute an SQL statement against the data store.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
statement |
string
|
SQL statement to execute. |
spatial_filter |
Geometry
|
Geometry which represents a spatial filter. |
dialect |
string
|
Allows control of the statement dialect. If
set to
|
callback |
callback
<
Layer
>
|
function flush() src/gdal_dataset.cpp
Flushes all changes to disk.
Throwsfunction flushAsync() src/gdal_dataset.cpp
Flushes all changes to disk.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function getFileList() src/gdal_dataset.cpp
Fetch files forming dataset.
Returns a list of files believed to be part of this dataset. If it returns an empty list of files it means there is believed to be no local file system files associated with the dataset (for instance a virtual dataset).
Returns an empty array for vector datasets if GDAL version is below 2.0
Returns Array
<
string
>
function getGCPProjection() src/gdal_dataset.cpp
Get output projection for GCPs.
Returns string
function getGCPs() src/gdal_dataset.cpp
Fetches GCPs.
Returns Array
<
any
>
function getMetadata() src/gdal_dataset.cpp
Fetch metadata.
Parameter | Type | Description |
---|---|---|
domain |
string
| undefined
|
any
function getMetadataAsync() src/gdal_dataset.cpp
Fetch metadata.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
domain |
string
| undefined
|
|
callback |
callback
<
void
>
|
Promise
<
any
>
function setGCPs() src/gdal_dataset.cpp
Sets GCPs.
Parameter | Type | Description |
---|---|---|
gcps |
Array
<
object
>
|
|
projection |
string
| undefined
|
function setMetadata() src/gdal_dataset.cpp
Set metadata. Can return a warning (false) for formats not supporting persistent metadata.
Parameter | Type | Description |
---|---|---|
metadata |
object
| Array
<
string
>
|
|
domain |
string
| undefined
|
boolean
function setMetadataAsync() src/gdal_dataset.cpp
Set metadata. Can return a warning (false) for formats not supporting persistent metadata.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
metadata |
object
| Array
<
string
>
|
|
domain |
string
| undefined
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function testCapability() src/gdal_dataset.cpp
Determines if the dataset supports the indicated operation.
Parameter | Type | Description |
---|---|---|
capability |
string
|
boolean
class DatasetBands src/collections/dataset_bands.cpp
An encapsulation of a Dataset raster bands.
Examplevar bands = dataset.bands;
function forEach() lib/iterators.js
Iterates through all bands using a callback function. Note: GDAL band indexes start at 1, not 0.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
RasterBand
>
|
The callback to be called with each RasterBand |
dataset.bands.forEach(function(band, i) { ... });
function getEnvelope() lib/gdal.js
Returns a Envelope object for the raster bands
Returns Exampleconst extent = dataset.getEnvelope()
`
function Symbol.asyncIterator() : RasterBand lib/iterators.js
Iterates through all bands using an async iterator
Examplefor await (const band of dataset.bands) {
}
function Symbol.iterator() : RasterBand lib/iterators.js
Iterates through all bands using an iterator
Examplefor (const band of dataset.bands) {
}
ds : Dataset src/collections/dataset_bands.cpp
Returns the parent dataset.
function count() src/collections/dataset_bands.cpp
Returns the number of bands.
Returns number
function countAsync() src/collections/dataset_bands.cpp
Returns the number of bands.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function create() src/collections/dataset_bands.cpp
Adds a new band.
Parameter | Type | Description |
---|---|---|
dataType |
string
|
Type of band ( see GDT constants ) |
options |
object
| Array
<
string
>
| undefined
|
Creation options |
function createAsync() src/collections/dataset_bands.cpp
Adds a new band.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
dataType |
string
|
Type of band ( see GDT constants ) |
options |
object
| Array
<
string
>
| undefined
|
Creation options |
callback |
callback
<
RasterBand
>
|
Promise
<
RasterBand
>
function get() src/collections/dataset_bands.cpp
Returns the band with the given ID.
Parameter | Type | Description |
---|---|---|
id |
number
|
function getAsync() src/collections/dataset_bands.cpp
Returns the band with the given ID.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
id |
number
|
|
callback |
callback
<
RasterBand
>
|
Promise
<
RasterBand
>
function map() lib/default_iterators.js
Iterates through raster bands using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
RasterBand
, U
>
|
The callback to be called with each RasterBand |
Array
<
U
>
var result = dataset.bands.map(function(array, i) {
return value;
});
class Driver src/gdal_driver.cpp
Format specific driver.
An instance of this class is created for each supported format, and manages information about the format.
This roughly corresponds to a file format, though some drivers may be gateways to many formats through a secondary multi-library.
description : string src/gdal_driver.cpp
function copyFiles() src/gdal_driver.cpp
Copy the files of a dataset.
Parameter | Type | Description |
---|---|---|
name_old |
string
|
New name for the dataset. |
name_new |
string
|
Old name of the dataset. |
function create() src/gdal_driver.cpp
Create a new dataset with this driver.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
x_size |
number
|
raster width in pixels (ignored for vector datasets) |
y_size |
number
|
raster height in pixels (ignored for vector datasets) |
band_count |
number
|
|
data_type |
string
|
pixel data type (ignored for vector datasets) (see data types |
creation_options |
StringOptions
| undefined
|
An array or object containing driver-specific dataset creation options |
function createAsync() src/gdal_driver.cpp
Asynchronously create a new dataset with this driver.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
x_size |
number
|
raster width in pixels (ignored for vector datasets) |
y_size |
number
|
raster height in pixels (ignored for vector datasets) |
band_count |
number
|
|
data_type |
string
|
pixel data type (ignored for vector datasets) (see data types |
creation_options |
StringOptions
| undefined
|
An array or object containing driver-specific dataset creation options |
callback |
callback
<
Dataset
>
|
function createCopy() src/gdal_driver.cpp
Create a copy of a dataset.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
src |
Dataset
|
|
options |
StringOptions
|
An array or object containing driver-specific dataset creation options |
strict |
boolean
|
strict mode |
jsoptions |
CreateOptions
| undefined
|
additional options |
function createCopyAsync() src/gdal_driver.cpp
Asynchronously create a copy of a dataset.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
src |
Dataset
|
|
options |
StringOptions
|
An array or object containing driver-specific dataset creation options |
strict |
boolean
|
strict mode |
jsoptions |
CreateOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
function deleteDataset() src/gdal_driver.cpp
Parameter | Type | Description |
---|---|---|
filename |
string
|
function getMetadata() src/gdal_driver.cpp
Returns metadata about the driver.
Parameter | Type | Description |
---|---|---|
domain |
string
| undefined
|
any
function open() src/gdal_driver.cpp
Opens a dataset.
Parameter | Type | Description |
---|---|---|
path |
string
|
|
mode |
string
|
The mode to use to open the file:
|
options |
StringOptions
| undefined
|
Driver-specific open options |
function openAsync() src/gdal_driver.cpp
Opens a dataset.
Parameter | Type | Description |
---|---|---|
path |
string
|
|
mode |
string
|
The mode to use to open the file:
|
options |
StringOptions
| undefined
|
Driver-specific open options |
callback |
callback
<
Dataset
>
|
function rename() src/gdal_driver.cpp
Renames the dataset.
Parameter | Type | Description |
---|---|---|
new_name |
string
|
New name for the dataset. |
old_name |
string
|
Old name of the dataset. |
class GDALDrivers src/collections/gdal_drivers.cpp
An collection of all Driver registered with GDAL.
function count() src/collections/gdal_drivers.cpp
Returns the number of drivers registered with GDAL.
Returns number
function forEach() lib/default_iterators.js
Iterates through all drivers using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Driver
>
|
The callback to be called with each Driver |
gdal.drivers.forEach(function(array, i) { ... });
function get() src/collections/gdal_drivers.cpp
Returns a driver with the specified name.
Note: Prior to GDAL2.x there is a separate driver for vector VRTs and raster
VRTs. Use
"VRT:vector"
to fetch the vector VRT driver and
"VRT:raster"
to
fetch the raster VRT driver.
Parameter | Type | Description |
---|---|---|
index |
number
| string
|
0-based index or driver name |
function getNames() src/collections/gdal_drivers.cpp
Returns an array with the names of all the drivers registered with GDAL.
Returns Array
<
string
>
function map() lib/default_iterators.js
Iterates through drivers using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Driver
, U
>
|
The callback to be called with each Driver |
Array
<
U
>
var result = gdal.drivers.map(function(array, i) {
return value;
});
function prototype() : Driver lib/default_iterators.js
Iterates through all drivers using an iterator
Examplefor (const array of gdal.drivers) {
}
class RasterBand src/gdal_rasterband.cpp
A single raster band (or channel).
blockSize : xyz src/gdal_rasterband.cpp
Size object containing
"x"
and
"y"
properties.
blockSizeAsync : Promise < xyz > src/gdal_rasterband.cpp
Size object containing
"x"
and
"y"
properties.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
categoryNames : Array < string > src/gdal_rasterband.cpp
List of list of category names for this raster.
categoryNamesAsync : Promise < Array < string > > src/gdal_rasterband.cpp
List of list of category names for this raster.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
colorInterpretation : string | null src/gdal_rasterband.cpp
Color interpretation mode ( see GCI constants )
colorInterpretationAsync : Promise < string | null > src/gdal_rasterband.cpp
Color interpretation mode ( see GCI constants )
Asynchronous read-only getter. Returns a Promise that resolves with the result.
colorTable : ColorTable | null src/gdal_rasterband.cpp
Color table ( see ColorTable )
colorTableAsync : Promise < ColorTable | null > src/gdal_rasterband.cpp
Color table ( see ColorTable )
Asynchronous read-only getter. Returns a Promise that resolves with the result.
dataType : string | null src/gdal_rasterband.cpp
Pixel data type ( see GDT constants used for this band.
dataTypeAsync : Promise < string | null > src/gdal_rasterband.cpp
Pixel data type ( see GDT constants used for this band.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
description : string src/gdal_rasterband.cpp
Name of of band.
descriptionAsync : Promise < string > src/gdal_rasterband.cpp
Name of of band.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
ds : Dataset src/gdal_rasterband.cpp
hasArbitraryOverviews : boolean src/gdal_rasterband.cpp
An indicator if the underlying datastore can compute arbitrary overviews
efficiently, such as is the case with OGDI over a network. Datastores with
arbitrary overviews don't generally have any fixed overviews, but GDAL's
RasterIO()
method can be used in downsampling mode to get overview
data efficiently.
hasArbitraryOverviewsAsync : Promise < boolean > src/gdal_rasterband.cpp
An indicator if the underlying datastore can compute arbitrary overviews
efficiently, such as is the case with OGDI over a network. Datastores with
arbitrary overviews don't generally have any fixed overviews, but GDAL's
RasterIO()
method can be used in downsampling mode to get overview
data efficiently.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
id : number | null src/gdal_rasterband.cpp
idAsync : Promise < number | null > src/gdal_rasterband.cpp
Asynchronous read-only getter. Returns a Promise that resolves with the result.
maximum : number | null src/gdal_rasterband.cpp
Maximum value for this band.
maximumAsync : Promise < number | null > src/gdal_rasterband.cpp
Maximum value for this band.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
minimum : number | null src/gdal_rasterband.cpp
Minimum value for this band.
minimumAsync : Promise < number | null > src/gdal_rasterband.cpp
Minimum value for this band.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
noDataValue : number | null src/gdal_rasterband.cpp
No data value for this band.
noDataValueAsync : Promise < number | null > src/gdal_rasterband.cpp
No data value for this band.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
offset : number | null src/gdal_rasterband.cpp
Raster value offset.
offsetAsync : Promise < number | null > src/gdal_rasterband.cpp
Raster value offset.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
overviews : RasterBandOverviews src/gdal_rasterband.cpp
pixels : RasterBandPixels src/gdal_rasterband.cpp
readOnly : boolean src/gdal_rasterband.cpp
Indicates if the band is read-only.
readOnlyAsync : Promise < boolean > src/gdal_rasterband.cpp
Indicates if the band is read-only.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
scale : number | null src/gdal_rasterband.cpp
Raster value scale.
scaleAsync : Promise < number | null > src/gdal_rasterband.cpp
Raster value scale.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
size : xyz src/gdal_rasterband.cpp
Size object containing
"x"
and
"y"
properties.
sizeAsync : Promise < xyz > src/gdal_rasterband.cpp
Size object containing
"x"
and
"y"
properties.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
unitType : string | null src/gdal_rasterband.cpp
Raster unit type (name for the units of this raster's values).
For instance, it might be
"m"
for an elevation model in meters,
or
"ft"
for feet. If no units are available, a value of
""
will be returned.
unitTypeAsync : Promise < string | null > src/gdal_rasterband.cpp
Raster unit type (name for the units of this raster's values).
For instance, it might be
"m"
for an elevation model in meters,
or
"ft"
for feet. If no units are available, a value of
""
will be returned.
Asynchronous read-only getter. Returns a Promise that resolves with the result.
function asMDArray() src/gdal_rasterband.cpp
Return a view of this raster band as a 2D multidimensional GDALMDArray.
The band must be linked to a GDALDataset.
If the dataset has a geotransform attached, the X and Y dimensions of the returned array will have an associated indexing variable.
Requires GDAL>=3.3 with MDArray support, won't be defined otherwise
Throws Returnsfunction computeStatistics() src/gdal_rasterband.cpp
Computes image statistics.
Returns the minimum, maximum, mean and standard deviation of all pixel values
in this band. If approximate statistics are sufficient, the
allow_approximation
argument can be set to
true
in which case overviews,
or a subset of image tiles may be used in computing the statistics.
Parameter | Type | Description |
---|---|---|
allow_approximation |
boolean
|
If
|
stats
Statistics containing
"min"
,
"max"
,
"mean"
,
"std_dev"
properties.
function computeStatisticsAsync() src/gdal_rasterband.cpp
Computes image statistics. {{async}}
Returns the minimum, maximum, mean and standard deviation of all pixel values
in this band. If approximate statistics are sufficient, the
allow_approximation
argument can be set to
true
in which case overviews,
or a subset of image tiles may be used in computing the statistics.
Parameter | Type | Description |
---|---|---|
allow_approximation |
boolean
|
If
|
callback |
callback
<
stats
>
|
function createMaskBand() src/gdal_rasterband.cpp
Adds a mask band to the current band.
Parameter | Type | Description |
---|---|---|
flags |
number
|
Mask flags |
function fill() src/gdal_rasterband.cpp
Fill this band with a constant value.
Parameter | Type | Description |
---|---|---|
real_value |
number
|
|
imaginary_value |
number
| undefined
|
function fillAsync() src/gdal_rasterband.cpp
Fill this band with a constant value.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
real_value |
number
|
|
imaginary_value |
number
| undefined
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function flush() src/gdal_rasterband.cpp
Saves changes to disk.
function flushAsync() src/gdal_rasterband.cpp
Saves changes to disk.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function getMaskBand() src/gdal_rasterband.cpp
Return the mask band associated with the band.
Returnsfunction getMaskFlags() src/gdal_rasterband.cpp
Return the status flags of the mask band associated with the band.
The result will be a bitwise OR-ed set of status flags with the following available definitions that may be extended in the future:
Returns number
Mask flags
function getMetadata() src/gdal_rasterband.cpp
Returns band metadata.
Parameter | Type | Description |
---|---|---|
domain |
string
| undefined
|
any
function getMetadataAsync() src/gdal_rasterband.cpp
Returns band metadata.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
domain |
string
| undefined
|
|
callback |
callback
<
any
>
|
Promise
<
any
>
function getStatistics() src/gdal_rasterband.cpp
Fetch image statistics.
Returns the minimum, maximum, mean and standard deviation of all pixel values
in this band. If approximate statistics are sufficient, the
allow_approximation
argument can be set to
true
in which case overviews,
or a subset of image tiles may be used in computing the statistics.
Parameter | Type | Description |
---|---|---|
allow_approximation |
boolean
|
If
|
force |
boolean
|
If
|
object
Statistics containing
"min"
,
"max"
,
"mean"
,
"std_dev"
properties.
function setMetadata() src/gdal_rasterband.cpp
Set metadata. Can return a warning (false) for formats not supporting persistent metadata.
Parameter | Type | Description |
---|---|---|
metadata |
object
| Array
<
string
>
|
|
domain |
string
| undefined
|
boolean
function setMetadataAsync() src/gdal_rasterband.cpp
Set metadata. Can return a warning (false) for formats not supporting persistent metadata.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
metadata |
object
| Array
<
string
>
|
|
domain |
string
| undefined
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function setStatistics() src/gdal_rasterband.cpp
Set statistics on the band. This method can be used to store min/max/mean/standard deviation statistics.
Parameter | Type | Description |
---|---|---|
min |
number
|
|
max |
number
|
|
mean |
number
|
|
std_dev |
number
|
class RasterBandPixels src/collections/rasterband_pixels.cpp
A representation of a RasterBand 's pixels.
Note: Typed arrays should be created with an external ArrayBuffer for versions of node >= 0.11
Exampleconst n = 16*16;
const data = new Float32Array(new ArrayBuffer(n*4));
//read data into the existing array
band.pixels.read(0,0,16,16,data);
typedef ReadOptions : object src/collections/rasterband_pixels.cpp
Property | Type | Description |
---|---|---|
buffer_width
|
number
| undefined
|
|
buffer_height
|
number
| undefined
|
|
type
|
string
| undefined
|
|
data_type
|
string
| undefined
|
|
pixel_space
|
number
| undefined
|
|
line_space
|
number
| undefined
|
|
resampling
|
string
| undefined
|
|
progress_cb
|
ProgressCb
| undefined
|
|
offset
|
number
| undefined
|
typedef TypedArray : Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array src/collections/rasterband_pixels.cpp
typedef WriteOptions : object src/collections/rasterband_pixels.cpp
Property | Type | Description |
---|---|---|
buffer_width
|
number
| undefined
|
|
buffer_height
|
number
| undefined
|
|
pixel_space
|
number
| undefined
|
|
line_space
|
number
| undefined
|
|
progress_cb
|
ProgressCb
| undefined
|
|
offset
|
number
| undefined
|
band : RasterBand src/collections/rasterband_pixels.cpp
Returns the parent raster band.
function clampBlock() src/collections/rasterband_pixels.cpp
Clamp the block size for a given block offset. Handles partial blocks at the edges of the raster and returns the true number of pixels.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
xyz
A size object.
function clampBlockAsync() src/collections/rasterband_pixels.cpp
Clamp the block size for a given block offset. Handles partial blocks at the edges of the raster and returns the true number of pixels.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
callback |
callback
<
xyz
>
|
function createReadStream() lib/readable.js
create a Readable stream from a raster band
Parameter | Type | Description |
---|---|---|
options |
RasterReadableOptions
| undefined
|
function createWriteStream() lib/writable.js
create a Writable stream from a raster band
Parameter | Type | Description |
---|---|---|
options |
RasterWritableOptions
| undefined
|
function get() src/collections/rasterband_pixels.cpp
Returns the value at the x, y coordinate.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
number
function getAsync() src/collections/rasterband_pixels.cpp
Returns the value at the x, y coordinate.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
callback |
callback
<
number
>
|
Promise
<
number
>
function read() src/collections/rasterband_pixels.cpp
Reads a region of pixels.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
width |
number
|
|
height |
number
|
|
data |
TypedArray
| undefined
|
The
|
options |
ReadOptions
| undefined
|
TypedArray
A
TypedArray
of values.
function readAsync() src/collections/rasterband_pixels.cpp
Asynchronously reads a region of pixels.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
width |
number
|
the width |
height |
number
|
|
data |
TypedArray
| undefined
|
The
|
options |
ReadOptions
| undefined
|
|
callback |
callback
<
TypedArray
>
|
Promise
<
TypedArray
>
A
TypedArray
of values.
function readBlock() src/collections/rasterband_pixels.cpp
Reads a block of pixels.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
data |
TypedArray
| undefined
|
The
|
TypedArray
A
TypedArray
of values.
function readBlockAsync() src/collections/rasterband_pixels.cpp
Reads a block of pixels.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
data |
TypedArray
| undefined
|
The
|
callback |
callback
<
TypedArray
>
|
Promise
<
TypedArray
>
A
TypedArray
of values.
function set() src/collections/rasterband_pixels.cpp
Sets the value at the x, y coordinate.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
value |
number
|
function setAsync() src/collections/rasterband_pixels.cpp
Sets the value at the x, y coordinate.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
value |
number
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function write() src/collections/rasterband_pixels.cpp
Writes a region of pixels.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
width |
number
|
|
height |
number
|
|
data |
TypedArray
| undefined
|
The
|
options |
WriteOptions
| undefined
|
function writeAsync() src/collections/rasterband_pixels.cpp
Asynchronously writes a region of pixels.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
width |
number
|
|
height |
number
|
|
data |
TypedArray
| undefined
|
The
|
options |
WriteOptions
| undefined
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function writeBlock() src/collections/rasterband_pixels.cpp
Writes a block of pixels.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
data |
TypedArray
|
The
|
function writeBlockAsync() src/collections/rasterband_pixels.cpp
Writes a block of pixels.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
data |
TypedArray
|
The
|
callback |
callback
<
void
>
|
Promise
<
void
>
class RasterBandOverviews src/collections/rasterband_overviews.cpp
An encapsulation of a RasterBand overview functionality.
function asyncIterator() : RasterBand lib/default_iterators.js
Iterates through all overviews using an async iterator
Examplefor await (const array of band.overviews) {
}
function count() src/collections/rasterband_overviews.cpp
Returns the number of overviews.
Returns number
function countAsync() src/collections/rasterband_overviews.cpp
Returns the number of overviews.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all overviews using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
RasterBand
>
|
The callback to be called with each RasterBand |
band.overviews.forEach(function(array, i) { ... });
function get() src/collections/rasterband_overviews.cpp
Fetches the overview at the provided index.
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index |
function getAsync() src/collections/rasterband_overviews.cpp
Fetches the overview at the provided index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index |
callback |
callback
<
RasterBand
>
|
Promise
<
RasterBand
>
function getBySampleCount() src/collections/rasterband_overviews.cpp
Fetch best sampling overview.
Returns the most reduced overview of the given band that still satisfies the desired number of samples. This function can be used with zero as the number of desired samples to fetch the most reduced overview. The same band as was passed in will be returned if it has not overviews, or if none of the overviews have enough samples.
Parameter | Type | Description |
---|---|---|
samples |
number
|
function getBySampleCountAsync() src/collections/rasterband_overviews.cpp
Fetch best sampling overview.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
samples |
number
|
|
callback |
callback
<
RasterBand
>
|
Promise
<
RasterBand
>
function map() lib/default_iterators.js
Iterates through overviews using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
RasterBand
, U
>
|
The callback to be called with each RasterBand |
Array
<
U
>
var result = band.overviews.map(function(array, i) {
return value;
});
function prototype() : RasterBand lib/default_iterators.js
Iterates through all overviews using an iterator
Examplefor (const array of band.overviews) {
}
class ColorTable src/collections/colortable.cpp
An encapsulation of a RasterBand color table.
Parameter | Type | Description |
---|---|---|
interpretation |
string
|
palette interpretation |
var colorTable = band.colorTable;
band.colorTable = new gdal.ColorTable(gdal.GPI_RGB);
typedef Color : object src/collections/colortable.cpp
Property | Type | Description |
---|---|---|
c1
|
number
|
|
c2
|
number
|
|
c3
|
number
|
|
c4
|
number
|
band : RasterBand | src/collections/colortable.cpp
Returns the parent band.
interpretation : string src/collections/colortable.cpp
Color interpretation of the palette.
function clone() src/collections/colortable.cpp
Clones the instance. The newly created ColorTable is not owned by any RasterBand.
Returnsfunction count() src/collections/colortable.cpp
Returns the number of color entries.
Returns number
function forEach() lib/default_iterators.js
Iterates through all color entries using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Color
>
|
The callback to be called with each Color |
band.colorTable.forEach(function(array, i) { ... });
function get() src/collections/colortable.cpp
Returns the color with the given ID.
Parameter | Type | Description |
---|---|---|
index |
number
|
function isSame() src/collections/colortable.cpp
Compares two ColorTable objects for equality.
Parameter | Type | Description |
---|---|---|
other |
ColorTable
|
boolean
function map() lib/default_iterators.js
Iterates through color entries using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Color
, U
>
|
The callback to be called with each Color |
Array
<
U
>
var result = band.colorTable.map(function(array, i) {
return value;
});
function prototype() : Color lib/default_iterators.js
Iterates through all color entries using an iterator
Examplefor (const array of band.colorTable) {
}
function ramp() src/collections/colortable.cpp
Creates a color ramp from one color entry to another.
Parameter | Type | Description |
---|---|---|
start_index |
number
|
|
start_color |
Color
|
|
end_index |
number
|
|
end_color |
Color
|
number
total number of color entries
function set() src/collections/colortable.cpp
Sets the color entry with the given ID.
Parameter | Type | Description |
---|---|---|
index |
number
|
|
color |
Color
|
void
class Layer src/gdal_layer.cpp
A representation of a layer of simple vector features, with access methods.
ds : Dataset src/gdal_layer.cpp
features : LayerFeatures src/gdal_layer.cpp
fidColumn : string src/gdal_layer.cpp
fields : LayerFields src/gdal_layer.cpp
geomColumn : string src/gdal_layer.cpp
geomType : number src/gdal_layer.cpp
name : string src/gdal_layer.cpp
srs : SpatialReference src/gdal_layer.cpp
function flush() src/gdal_layer.cpp
Flush pending changes to disk.
Throwsfunction flushAsync() src/gdal_layer.cpp
Flush pending changes to disk.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function getExtent() src/gdal_layer.cpp
Fetch the extent of this layer.
Parameter | Type | Description |
---|---|---|
force |
boolean
|
Envelope
Bounding envelope
function getSpatialFilter() src/gdal_layer.cpp
This method returns the current spatial filter for this layer.
Throws Returnsfunction setAttributeFilter() src/gdal_layer.cpp
Sets the attribute query string to be used when fetching features via the
layer.features.next()
method. Only features for which the query evaluates
as
true
will be returned.
The query string should be in the format of an SQL WHERE clause. For instance
"population > 1000000 and population < 5000000" where
population
is an
attribute in the layer. The query format is normally a restricted form of
SQL WHERE clause as described in the "WHERE" section of the
OGR SQL
tutorial
. In some cases (RDBMS backed
drivers) the native capabilities of the database may be used to interprete
the WHERE clause in which case the capabilities will be broader than those
of OGR SQL.
Parameter | Type | Description |
---|---|---|
filter |
string
|
null
|
layer.setAttributeFilter('population > 1000000 and population < 5000000');
function setSpatialFilter() src/gdal_layer.cpp
This method sets the geometry to be used as a spatial filter when fetching
features via the
layer.features.next()
method. Only features that
geometrically intersect the filter geometry will be returned.
Alernatively you can pass it envelope bounds as individual arguments.
Parameter | Type | Description |
---|---|---|
filter |
Geometry
|
null
|
layer.setSpatialFilter(geometry);
function setSpatialFilter() src/gdal_layer.cpp
This method sets the geometry to be used as a spatial filter when fetching
features via the
layer.features.next()
method. Only features that
geometrically intersect the filter geometry will be returned.
Alernatively you can pass it envelope bounds as individual arguments.
Parameter | Type | Description |
---|---|---|
minxX |
number
|
|
minyY |
number
|
|
maxX |
number
|
|
maxY |
number
|
layer.setSpatialFilter(minX, minY, maxX, maxY);
function testCapability() src/gdal_layer.cpp
Determines if the dataset supports the indicated operation.
Parameter | Type | Description |
---|---|---|
capability |
string
|
(see capability list |
boolean
class DatasetLayers src/collections/dataset_layers.cpp
An encapsulation of a Dataset vector layers.
Examplevar layers = dataset.layers;
ds : Dataset src/collections/dataset_layers.cpp
Returns the parent dataset.
function asyncIterator() : Layer lib/default_iterators.js
Iterates through all layers using an async iterator
Examplefor await (const array of dataset.layers) {
}
function copy() src/collections/dataset_layers.cpp
Copies a layer.
Parameter | Type | Description |
---|---|---|
src_lyr_name |
Layer
|
|
dst_lyr_name |
string
|
|
options |
object
| Array
<
string
>
|
layer creation options |
function copyAsync() src/collections/dataset_layers.cpp
Copies a layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
src_lyr_name |
Layer
|
|
dst_lyr_name |
string
|
|
options |
object
| Array
<
string
>
|
layer creation options |
callback |
callback
<
Layer
>
|
function count() src/collections/dataset_layers.cpp
Returns the number of layers.
Returns number
function countAsync() src/collections/dataset_layers.cpp
Returns the number of layers.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function create() src/collections/dataset_layers.cpp
Adds a new layer.
Parameter | Type | Description |
---|---|---|
name |
string
|
Layer name |
srs |
SpatialReference
|
null
|
Layer projection |
geomType |
number
| Function
|
null
|
Geometry type or constructor ( see geometry types ) |
creation_options |
Array
<
string
>
| object
| undefined
|
driver-specific layer creation options |
dataset.layers.create('layername', null, gdal.Point);
function createAsync() src/collections/dataset_layers.cpp
Adds a new layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
name |
string
|
Layer name |
srs |
SpatialReference
|
null
|
Layer projection |
geomType |
number
| Function
|
null
|
Geometry type or constructor ( see geometry types ) |
creation_options |
Array
<
string
>
| object
| undefined
|
driver-specific layer creation options |
callback |
callback
<
Layer
>
|
await dataset.layers.createAsync('layername', null, gdal.Point);
dataset.layers.createAsync('layername', null, gdal.Point, (e, r) => console.log(e, r));
function forEach() lib/default_iterators.js
Iterates through all layers using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Layer
>
|
The callback to be called with each Layer |
dataset.layers.forEach(function(array, i) { ... });
function get() src/collections/dataset_layers.cpp
Returns the layer with the given name or identifier.
Parameter | Type | Description |
---|---|---|
key |
string
| number
|
Layer name or ID. |
function getAsync() src/collections/dataset_layers.cpp
Returns the layer with the given name or identifier.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
key |
string
| number
|
Layer name or ID. |
callback |
callback
<
Layer
>
|
function map() lib/default_iterators.js
Iterates through layers using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Layer
, U
>
|
The callback to be called with each Layer |
Array
<
U
>
var result = dataset.layers.map(function(array, i) {
return value;
});
function prototype() : Layer lib/default_iterators.js
Iterates through all layers using an iterator
Examplefor (const array of dataset.layers) {
}
function remove() src/collections/dataset_layers.cpp
Removes a layer.
Parameter | Type | Description |
---|---|---|
index |
number
|
function removeAsync() src/collections/dataset_layers.cpp
Removes a layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
index |
number
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
class SpatialReference src/gdal_spatial_reference.cpp
This class respresents a OpenGIS Spatial Reference System, and contains methods for converting between this object organization and well known text (WKT) format.
Parameter | Type | Description |
---|---|---|
wkt |
string
| undefined
|
function autoIdentifyEPSG() src/gdal_spatial_reference.cpp
Set EPSG authority info if possible.
Throwsfunction clone() src/gdal_spatial_reference.cpp
Clones the spatial reference.
Returnsfunction cloneGeogCS() src/gdal_spatial_reference.cpp
Make a duplicate of the GEOGCS node of this OGRSpatialReference object.
Returnsfunction EPSGTreatsAsLatLong() src/gdal_spatial_reference.cpp
This method returns
true
if EPSG feels this geographic coordinate system
should be treated as having lat/long coordinate ordering.
Currently this returns
true
for all geographic coordinate systems with an
EPSG code set, and AXIS values set defining it as lat, long. Note that
coordinate systems with an EPSG code and no axis settings will be assumed
to not be lat/long.
false
will be returned for all coordinate systems that are not geographic,
or that do not have an EPSG code set.
boolean
function EPSGTreatsAsNorthingEasting() src/gdal_spatial_reference.cpp
This method returns
true
if EPSG feels this projected coordinate system
should be treated as having northing/easting coordinate ordering.
boolean
function fromCRSURL() src/gdal_spatial_reference.cpp
Initialize from OGC URL.
The OGC URL should be prefixed with " http://opengis.net/def/crs " per best practice paper 11-135. Currently EPSG and OGC authority values are supported, including OGC auto codes, but not including CRS1 or CRS88 (NAVD88).
Parameter | Type | Description |
---|---|---|
input |
string
|
function fromCRSURLAsync() src/gdal_spatial_reference.cpp
Initialize from OGC URL.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
input |
string
|
|
callback |
callback
<
SpatialReference
>
|
function fromEPSG() src/gdal_spatial_reference.cpp
Initialize from EPSG GCS or PCS code.
Parameter | Type | Description |
---|---|---|
input |
number
|
var ref = gdal.SpatialReference.fromEPSGA(4326);
function fromEPSGA() src/gdal_spatial_reference.cpp
Initialize from EPSG GCS or PCS code.
This method is similar to
fromEPSG()
except that EPSG preferred axis
ordering
be applied for geographic and projected coordinate systems.
EPSG normally defines geographic coordinate systems to use lat/long, and also
there are also a few projected coordinate systems that use northing/easting
order contrary to typical GIS use).
Parameter | Type | Description |
---|---|---|
input |
number
|
var ref = gdal.SpatialReference.fromEPSGA(26910);
function fromESRI() src/gdal_spatial_reference.cpp
Import coordinate system from ESRI .prj format(s).
This function will read the text loaded from an ESRI .prj file, and translate it into an OGRSpatialReference definition. This should support many (but by no means all) old style (Arc/Info 7.x) .prj files, as well as the newer pseudo-OGC WKT .prj files. Note that new style .prj files are in OGC WKT format, but require some manipulation to correct datum names, and units on some projection parameters. This is addressed within importFromESRI() by an automatical call to morphFromESRI().
Currently only GEOGRAPHIC, UTM, STATEPLANE, GREATBRITIAN_GRID, ALBERS, EQUIDISTANT_CONIC, TRANSVERSE (mercator), POLAR, MERCATOR and POLYCONIC projections are supported from old style files.
Parameter | Type | Description |
---|---|---|
input |
object
| Array
<
string
>
|
function fromMICoordSys() src/gdal_spatial_reference.cpp
Initialize from a Mapinfo style CoordSys definition.
Parameter | Type | Description |
---|---|---|
input |
string
|
function fromProj4() src/gdal_spatial_reference.cpp
Creates a spatial reference from a Proj.4 string.
Parameter | Type | Description |
---|---|---|
input |
string
|
function fromURL() src/gdal_spatial_reference.cpp
Initialize spatial reference from a URL.
This method will download the spatial reference from the given URL.
Parameter | Type | Description |
---|---|---|
url |
string
|
function fromURLAsync() src/gdal_spatial_reference.cpp
Initialize spatial reference from a URL. {{async}}
This method will download the spatial reference from the given URL.
Parameter | Type | Description |
---|---|---|
url |
string
|
|
callback |
callback
<
SpatialReference
>
|
function fromURN() src/gdal_spatial_reference.cpp
Initialize from OGC URN.
The OGC URN should be prefixed with "urn:ogc:def:crs:" per recommendation paper 06-023r1. Currently EPSG and OGC authority values are supported, including OGC auto codes, but not including CRS1 or CRS88 (NAVD88).
Parameter | Type | Description |
---|---|---|
input |
string
|
function fromUserInput() src/gdal_spatial_reference.cpp
Initialize from an arbitrary spatial reference string.
This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system.
Parameter | Type | Description |
---|---|---|
input |
string
|
function fromUserInputAsync() src/gdal_spatial_reference.cpp
Initialize from an arbitrary spatial reference string.
This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
input |
string
|
|
callback |
callback
<
SpatialReference
>
|
function fromWKT() src/gdal_spatial_reference.cpp
Creates a spatial reference from a WKT string.
Parameter | Type | Description |
---|---|---|
wkt |
string
|
function fromWMSAUTO() src/gdal_spatial_reference.cpp
Creates a spatial reference from a WMSAUTO string.
Note that the WMS 1.3 specification does not include the units code, while apparently earlier specs do. GDAL tries to guess around this.
Parameter | Type | Description |
---|---|---|
input |
string
|
var wms = 'AUTO:42001,99,8888';
var ref = gdal.SpatialReference.fromWMSAUTO(wms);
function fromXML() src/gdal_spatial_reference.cpp
Import coordinate system from XML format (GML only currently).
Parameter | Type | Description |
---|---|---|
input |
string
|
function getAngularUnits() src/gdal_spatial_reference.cpp
Fetch angular geographic coordinate system units.
Returns units
An object containing
value
and
unit
properties.
function getAttrValue() src/gdal_spatial_reference.cpp
Fetch indicated attribute of named node.
Parameter | Type | Description |
---|---|---|
node_name |
string
|
|
attr_index |
number
|
string
function getAuthorityCode() src/gdal_spatial_reference.cpp
Get the authority code for a node.
Parameter | Type | Description |
---|---|---|
target_key |
string
|
null
| undefined
|
The partial or complete path to the node to get an authority from. ie.
|
string
function getAuthorityName() src/gdal_spatial_reference.cpp
Get the authority name for a node. The most common authority is "EPSG".
Parameter | Type | Description |
---|---|---|
target_key |
string
|
null
| undefined
|
The partial or complete path to the node to get an authority from. ie.
|
string
function getLinearUnits() src/gdal_spatial_reference.cpp
Fetch linear geographic coordinate system units.
Returns units
An object containing
value
and
unit
properties.
function isCompound() src/gdal_spatial_reference.cpp
Check if compound coordinate system.
Returns boolean
function isGeocentric() src/gdal_spatial_reference.cpp
Check if geocentric coordinate system.
Returns boolean
function isGeographic() src/gdal_spatial_reference.cpp
Check if geographic coordinate system.
Returns boolean
function isLocal() src/gdal_spatial_reference.cpp
Check if local coordinate system.
Returns boolean
function isProjected() src/gdal_spatial_reference.cpp
Check if projected coordinate system.
Returns boolean
function isSame() src/gdal_spatial_reference.cpp
Do these two spatial references describe the same system?
Parameter | Type | Description |
---|---|---|
srs |
SpatialReference
|
boolean
function isSameGeogCS() src/gdal_spatial_reference.cpp
Do the GeogCS'es match?
Parameter | Type | Description |
---|---|---|
srs |
SpatialReference
|
boolean
function isSameVertCS() src/gdal_spatial_reference.cpp
Do the VertCS'es match?
Parameter | Type | Description |
---|---|---|
srs |
SpatialReference
|
boolean
function isVertical() src/gdal_spatial_reference.cpp
Check if vertical coordinate system.
Returns boolean
function morphFromESRI() src/gdal_spatial_reference.cpp
Convert in place from ESRI WKT format.
Throwsfunction morphToESRI() src/gdal_spatial_reference.cpp
Convert in place to ESRI WKT format.
Throwsfunction setWellKnownGeogCS() src/gdal_spatial_reference.cpp
Set a GeogCS based on well known name.
Parameter | Type | Description |
---|---|---|
name |
string
|
function toPrettyWKT() src/gdal_spatial_reference.cpp
Convert this SRS into a a nicely formatted WKT string for display to a person.
Parameter | Type | Description |
---|---|---|
simplify |
boolean
|
string
function toProj4() src/gdal_spatial_reference.cpp
Export coordinate system in PROJ.4 format.
Throws Returns string
function toWKT() src/gdal_spatial_reference.cpp
Convert this SRS into WKT format.
Throws Returns string
function toXML() src/gdal_spatial_reference.cpp
Export coordinate system in XML format.
Throws Returns string
function validate() src/gdal_spatial_reference.cpp
Validate SRS tokens.
This method attempts to verify that the spatial reference system is well formed, and consists of known tokens. The validation is not comprehensive.
Returns string
|
null
"corrupt"
, '"unsupported"',
null
(if fine)
class CoordinateTransformation src/gdal_coordinate_transformation.cpp
Object for transforming between coordinate systems.
Parameter | Type | Description |
---|---|---|
source |
SpatialReference
|
|
target |
SpatialReference
| Dataset
|
If a raster Dataset, the conversion will represent a conversion to pixel coordinates. |
function transformPoint() src/gdal_coordinate_transformation.cpp
Transform point from source to destination space.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
z |
number
| undefined
|
pt = transform.transformPoint(0, 0, 0);
function transformPoint() src/gdal_coordinate_transformation.cpp
Transform point from source to destination space.
Parameter | Type | Description |
---|---|---|
point |
xyz
|
pt = transform.transformPoint({x: 0, y: 0, z: 0});
Features
Classes for working with vector features
class LayerFields src/collections/layer_fields.cpp
function fromJSON() lib/gdal.js
Creates a LayerFields instance from an object of keys and values.
Parameter | Type | Description |
---|---|---|
object |
object
|
|
approx_ok |
boolean
|
function fromObject() lib/gdal.js
Creates a LayerFields instance from an object of keys and values.
Parameter | Type | Description |
---|---|---|
object |
Record
<
string
, any
>
|
|
approx_ok |
boolean
|
layer : Layer src/collections/layer_fields.cpp
Returns the parent layer.
function add() src/collections/layer_fields.cpp
Adds field(s).
Parameter | Type | Description |
---|---|---|
defs |
FieldDefn
| Array
<
FieldDefn
>
|
A field definition, or array of field definitions. |
approx |
boolean
|
function asyncIterator() : FieldDefn lib/default_iterators.js
Iterates through all field definitions using an async iterator
Examplefor await (const array of layer.fields) {
}
function count() src/collections/layer_fields.cpp
Returns the number of fields.
Returns number
function forEach() lib/default_iterators.js
Iterates through all field definitions using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
FieldDefn
>
|
The callback to be called with each FieldDefn |
layer.fields.forEach(function(array, i) { ... });
function get() src/collections/layer_fields.cpp
Returns a field definition.
Parameter | Type | Description |
---|---|---|
field |
string
| number
|
Field name or index (0-based) |
function getNames() src/collections/layer_fields.cpp
Returns a list of field names.
Throws Returns Array
<
string
>
List of strings.
function indexOf() src/collections/layer_fields.cpp
Find the index of field in the layer.
Parameter | Type | Description |
---|---|---|
field |
string
|
number
Field index, or -1 if the field doesn't exist
function map() lib/default_iterators.js
Iterates through field definitions using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
FieldDefn
, U
>
|
The callback to be called with each FieldDefn |
Array
<
U
>
var result = layer.fields.map(function(array, i) {
return value;
});
function prototype() : FieldDefn lib/default_iterators.js
Iterates through all field definitions using an iterator
Examplefor (const array of layer.fields) {
}
function remove() src/collections/layer_fields.cpp
Removes a field.
Parameter | Type | Description |
---|---|---|
field |
string
| number
|
Field name or index (0-based) |
function reorder() src/collections/layer_fields.cpp
Reorders fields.
Parameter | Type | Description |
---|---|---|
map |
Array
<
number
>
|
An array of new indexes (integers) |
// reverse field order
layer.fields.reorder([2,1,0]);
class LayerFeatures src/collections/layer_features.cpp
An encapsulation of a Layer features.
function forEach() lib/iterators.js
Iterates through all features using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Feature
>
|
The callback to be called with each Feature |
layer.features.forEach(function(feature, i) { ... });
function Symbol.asyncIterator() : Feature lib/iterators.js
Iterates through all features using an async iterator
Examplefor await (const feature of layer.features) {
}
function Symbol.iterator() : Feature lib/iterators.js
Iterates through all features using an iterator
Examplefor (const feature of layer.features) {
}
layer : Layer src/collections/layer_features.cpp
Returns the parent layer.
function add() src/collections/layer_features.cpp
Adds a feature to the layer. The feature should be created using the current layer as the definition.
Parameter | Type | Description |
---|---|---|
feature |
Feature
|
var feature = new gdal.Feature(layer);
feature.setGeometry(new gdal.Point(0, 1));
feature.fields.set('name', 'somestring');
layer.features.add(feature);
function addAsync() src/collections/layer_features.cpp
Adds a feature to the layer. The feature should be created using the current layer as the definition.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
feature |
Feature
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
var feature = new gdal.Feature(layer);
feature.setGeometry(new gdal.Point(0, 1));
feature.fields.set('name', 'somestring');
await layer.features.addAsync(feature);
function count() src/collections/layer_features.cpp
Returns the number of features in the layer.
Parameter | Type | Description |
---|---|---|
force |
boolean
|
number
number of features in the layer.
function countAsync() src/collections/layer_features.cpp
Returns the number of features in the layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
force |
boolean
|
|
callback |
callback
<
number
>
|
Promise
<
number
>
number of features in the layer.
function first() src/collections/layer_features.cpp
Resets the feature pointer used by
next()
and
returns the first feature in the layer.
function firstAsync() src/collections/layer_features.cpp
Resets the feature pointer used by
next()
and
returns the first feature in the layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Feature
>
|
function get() src/collections/layer_features.cpp
Fetch a feature by its identifier.
The
id
argument is not an index. In most cases it will be
zero-based, but in some cases it will not. If iterating, it's best to use the
next()
method.
Parameter | Type | Description |
---|---|---|
id |
number
|
The feature ID of the feature to read. |
function getAsync() src/collections/layer_features.cpp
Fetch a feature by its identifier.
The
id
argument is not an index. In most cases it will be
zero-based, but in some cases it will not. If iterating, it's best to use the
next()
method.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
id |
number
|
The feature ID of the feature to read. |
callback |
callback
<
Feature
>
|
function map() lib/default_iterators.js
Iterates through features using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Feature
, U
>
|
The callback to be called with each Feature |
Array
<
U
>
var result = layer.features.map(function(array, i) {
return value;
});
function next() src/collections/layer_features.cpp
Returns the next feature in the layer. Returns null if no more features.
Returns Examplewhile (feature = layer.features.next()) { ... }
function nextAsync() src/collections/layer_features.cpp
Returns the next feature in the layer. Returns null if no more features.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Feature
>
|
while (feature = await layer.features.nextAsync()) { ... }
function remove() src/collections/layer_features.cpp
Removes a feature from the layer.
Parameter | Type | Description |
---|---|---|
id |
number
|
function removeAsync() src/collections/layer_features.cpp
Removes a feature from the layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
id |
number
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function set() src/collections/layer_features.cpp
Sets a feature in the layer.
Parameter | Type | Description |
---|---|---|
feature |
Feature
|
function set() src/collections/layer_features.cpp
Sets a feature in the layer.
Parameter | Type | Description |
---|---|---|
id |
number
|
|
feature |
Feature
|
function setAsync() src/collections/layer_features.cpp
Sets a feature in the layer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
id |
number
|
|
feature |
Feature
|
|
callback |
callback
<
Feature
>
|
class Feature src/gdal_feature.cpp
A simple feature, including geometry and attributes. Its fields and geometry type is defined by the given definition.
Parameter | Type | Description |
---|---|---|
definition |
Layer
| FeatureDefn
|
//create layer and specify geometry type
var layer = dataset.layers.create('mylayer', null, gdal.Point);
//setup fields for the given layer
layer.fields.add(new gdal.FieldDefn('elevation', gdal.OFTInteger));
layer.fields.add(new gdal.FieldDefn('name', gdal.OFTString));
//create feature using layer definition and then add it to the layer
var feature = new gdal.Feature(layer);
feature.fields.set('elevation', 13775);
feature.fields.set('name', 'Grand Teton');
feature.setGeometry(new gdal.Point(43.741208, -110.802414));
layer.features.add(feature);
defn : FeatureDefn src/gdal_feature.cpp
fid : number src/gdal_feature.cpp
fields : FeatureFields src/gdal_feature.cpp
function clone() src/gdal_feature.cpp
Clones the feature.
Returnsfunction destroy() src/gdal_feature.cpp
Releases the feature from memory.
function equals() src/gdal_feature.cpp
Determines if the features are the same.
Parameter | Type | Description |
---|---|---|
feature |
Feature
|
boolean
true
if the features are the same,
false
if different
function getGeometry() src/gdal_feature.cpp
Returns the geometry of the feature.
Returnsfunction setFrom() src/gdal_feature.cpp
Set one feature from another. Overwrites the contents of this feature from the geometry and attributes of another.
Parameter | Type | Description |
---|---|---|
feature |
Feature
|
|
index_map |
Array
<
number
>
| undefined
|
Array mapping each field from the source feature to the given index in the destination feature. -1 ignores the source field. The field types must still match otherwise the behavior is undefined. |
forgiving |
boolean
|
|
var feature1 = new gdal.Feature(defn);
var feature2 = new gdal.Feature(defn);
feature1.setGeometry(new gdal.Point(5, 10));
feature1.fields.set([5, 'test', 3.14]);
feature2.setFrom(feature1);
function setGeometry() src/gdal_feature.cpp
Sets the feature's geometry.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
null
|
new geometry or null to clear the field |
class FeatureDefn src/gdal_feature_defn.cpp
Definition of a feature class or feature layer.
fields : FeatureDefnFields src/gdal_feature_defn.cpp
geomIgnored : boolean src/gdal_feature_defn.cpp
geomType : number src/gdal_feature_defn.cpp
WKB geometry type ( see table
name : string src/gdal_feature_defn.cpp
styleIgnored : boolean src/gdal_feature_defn.cpp
function clone() src/gdal_feature_defn.cpp
Clones the feature definition.
Returnsclass FeatureDefnFields src/collections/feature_defn_fields.cpp
An encapsulation of a FeatureDefn 's fields.
featureDefn : FeatureDefn src/collections/feature_defn_fields.cpp
Returns the parent feature definition.
function add() src/collections/feature_defn_fields.cpp
Adds field definition(s).
Parameter | Type | Description |
---|---|---|
fields |
FieldDefn
| Array
<
FieldDefn
>
|
function asyncIterator() : FieldDefn lib/default_iterators.js
Iterates through all field definitions using an async iterator
Examplefor await (const array of featureDefn) {
}
function count() src/collections/feature_defn_fields.cpp
Returns the number of fields.
Returns number
function forEach() lib/default_iterators.js
Iterates through all field definitions using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
FieldDefn
>
|
The callback to be called with each FieldDefn |
featureDefn.forEach(function(array, i) { ... });
function get() src/collections/feature_defn_fields.cpp
Returns a field definition.
Parameter | Type | Description |
---|---|---|
key |
string
| number
|
Field name or index |
function getNames() src/collections/feature_defn_fields.cpp
Returns a list of field names.
Returns Array
<
string
>
List of field names.
function indexOf() src/collections/feature_defn_fields.cpp
Returns the index of field definition.
Parameter | Type | Description |
---|---|---|
name |
string
|
number
Index or
-1
if not found.
function map() lib/default_iterators.js
Iterates through field definitions using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
FieldDefn
, U
>
|
The callback to be called with each FieldDefn |
Array
<
U
>
var result = featureDefn.map(function(array, i) {
return value;
});
function prototype() : FieldDefn lib/default_iterators.js
Iterates through all field definitions using an iterator
Examplefor (const array of featureDefn) {
}
function remove() src/collections/feature_defn_fields.cpp
Removes a field definition.
Parameter | Type | Description |
---|---|---|
key |
string
| number
|
Field name or index |
function reorder() src/collections/feature_defn_fields.cpp
Reorders the fields.
Parameter | Type | Description |
---|---|---|
map |
Array
<
number
>
|
An array representing the new field order. |
// reverse fields:
featureDef.fields.reorder([2, 1, 0]);
class FeatureFields src/collections/feature_fields.cpp
An encapsulation of all field data that makes up a Feature .
function forEach() lib/iterators.js
Iterates through all fields using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
any
>
|
The callback to be called with each feature
|
layer.features.get(0).fields.forEach(function(value, key) { ... });
function toJSON() lib/iterators.js
Outputs the fields as a serialized JSON string.
Returns string
Serialized JSON
feature : Feature src/collections/feature_fields.cpp
Returns the parent feature.
function count() src/collections/feature_fields.cpp
Returns the number of fields.
Returns number
feature.fields.count();
function get() src/collections/feature_fields.cpp
Returns a field's value.
Parameter | Type | Description |
---|---|---|
key |
string
| number
|
Feature name or index. |
any
value = feature.fields.get(0);
value = feature.fields.get('field');
function getNames() src/collections/feature_fields.cpp
Returns a list of field name.
Throws Returns Array
<
string
>
List of field names.
function indexOf() src/collections/feature_fields.cpp
Returns the index of a field, given its name.
Parameter | Type | Description |
---|---|---|
name |
string
|
number
Index or,
-1
if it cannot be found.
var index = feature.fields.indexOf('field');
function map() lib/default_iterators.js
Iterates through field definitions using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
any
, U
>
|
The callback to be called with each any |
Array
<
U
>
var result = layer.features.get(0).fields.map(function(array, i) {
return value;
});
function reset() src/collections/feature_fields.cpp
Resets all fields.
Parameter | Type | Description |
---|---|---|
values |
object
| undefined
|
void
feature.fields.reset();
function set() src/collections/feature_fields.cpp
Sets feature field(s).
Parameter | Type | Description |
---|---|---|
key |
string
| number
|
Field name or index |
value |
any
|
// most-efficient, least flexible. requires you to know the ordering of the
fields: feature.fields.set(['Something']); feature.fields.set(0,
'Something');
// most flexible.
feature.fields.set({name: 'Something'});
feature.fields.set('name', 'Something');
function set() src/collections/feature_fields.cpp
Parameter | Type | Description |
---|---|---|
fields |
object
|
function toArray() src/collections/feature_fields.cpp
Outputs the field values as a pure JS array.
Throws Returns Array
<
any
>
function toObject() src/collections/feature_fields.cpp
Outputs the field data as a pure JS object.
Throws Returns any
class FieldDefn src/gdal_field_defn.cpp
Parameter | Type | Description |
---|---|---|
name |
string
|
Field name |
type |
string
|
Data type (see (OFT)|OFT |
ignored : boolean src/gdal_field_defn.cpp
justification : string src/gdal_field_defn.cpp
Field justification (see OJ constants )
name : string src/gdal_field_defn.cpp
precision : number src/gdal_field_defn.cpp
type : string src/gdal_field_defn.cpp
Data type (see OFT constants
width : number src/gdal_field_defn.cpp
Geometries
Classes representing vector geometries
class Geometry src/geometry/gdal_geometry.cpp
Abstract base class for all geometry classes.
wkbType : number src/geometry/gdal_geometry.cpp
See wkbGeometryType .
function toObject() lib/iterators.js
Converts the geometry to a GeoJSON object representation.
Returns object
GeoJSON
coordinateDimension : number src/geometry/gdal_geometry.cpp
dimension : number src/geometry/gdal_geometry.cpp
name : string src/geometry/gdal_geometry.cpp
points : LineStringPoints src/geometry/gdal_simplecurve.cpp
The points that make up the SimpleCurve geometry.
srs : SpatialReference | null src/geometry/gdal_geometry.cpp
wkbSize : number src/geometry/gdal_geometry.cpp
wkbType : number src/geometry/gdal_geometry.cpp
See wkbGeometryType .
function boundary() src/geometry/gdal_geometry.cpp
Compute boundary.
Throws Returnsfunction boundaryAsync() src/geometry/gdal_geometry.cpp
Compute boundary.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Geometry
>
|
function buffer() src/geometry/gdal_geometry.cpp
Buffers the geometry by the given distance.
Parameter | Type | Description |
---|---|---|
distance |
number
|
|
segments |
number
|
function bufferAsync() src/geometry/gdal_geometry.cpp
Buffers the geometry by the given distance.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
distance |
number
|
|
segments |
number
|
|
callback |
callback
<
Geometry
>
|
function centroid() src/geometry/gdal_geometry.cpp
Compute the centroid of the geometry.
Throws Returnsfunction centroidAsync() src/geometry/gdal_geometry.cpp
Compute the centroid of the geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Geometry
>
|
function clone() src/geometry/gdal_geometry.cpp
Clones the instance.
Returnsfunction closeRings() src/geometry/gdal_geometry.cpp
Closes any un-closed rings.
function closeRingsAsync() src/geometry/gdal_geometry.cpp
Closes any un-closed rings.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function contains() src/geometry/gdal_geometry.cpp
Determines if the current geometry contains the provided geometry.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function containsAsync() src/geometry/gdal_geometry.cpp
Determines if the current geometry contains the provided geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function convexHull() src/geometry/gdal_geometry.cpp
Compute convex hull.
Throws Returnsfunction convexHullAsync() src/geometry/gdal_geometry.cpp
Compute convex hull.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Geometry
>
|
function create() src/geometry/gdal_geometry.cpp
Creates an empty Geometry from a WKB type.
Parameter | Type | Description |
---|---|---|
type |
number
|
WKB geometry type available options |
function crosses() src/geometry/gdal_geometry.cpp
Determines if the two geometries cross.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function crossesAsync() src/geometry/gdal_geometry.cpp
Determines if the two geometries cross.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function difference() src/geometry/gdal_geometry.cpp
Compute the difference of this geometry with another.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
function differenceAsync() src/geometry/gdal_geometry.cpp
Compute the difference of this geometry with another.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
Geometry
>
|
function disjoint() src/geometry/gdal_geometry.cpp
Determines if the two geometries are disjoint.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function disjointAsync() src/geometry/gdal_geometry.cpp
Determines if the two geometries are disjoint.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function distance() src/geometry/gdal_geometry.cpp
Computes the distance between the two geometries.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
number
function distanceAsync() src/geometry/gdal_geometry.cpp
Computes the distance between the two geometries.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
number
>
|
Promise
<
number
>
function empty() src/geometry/gdal_geometry.cpp
Clears the geometry.
function emptyAsync() src/geometry/gdal_geometry.cpp
Clears the geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function equals() src/geometry/gdal_geometry.cpp
Determines if the two geometries equal each other.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function equalsAsync() src/geometry/gdal_geometry.cpp
Determines if the two geometries equal each other.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function flattenTo2D() src/geometry/gdal_geometry.cpp
Convert geometry to strictly 2D.
Returns void
function flattenTo2DAsync() src/geometry/gdal_geometry.cpp
Convert geometry to strictly 2D.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function fromGeoJson() src/geometry/gdal_geometry.cpp
Creates a Geometry from a GeoJSON object fragment. The async version depends on V8 for object serialization and this part is not parallelizable. V8 objects cannot be accessed outside of the main thread. This function should not be used for importing objects of more than few tens of Kbytes when low latency is needed. If you need to import very large GeoJSON geometries in server code, use the much faster and completely parallel fromGeoJonBuffer(Async)
Parameter | Type | Description |
---|---|---|
geojson |
object
|
function fromGeoJsonAsync() src/geometry/gdal_geometry.cpp
Creates a Geometry from a GeoJSON object fragment. The async version depends on V8 for object serialization and this part is not parallelizable. V8 objects cannot be accessed outside of the main thread. This function should not be used for importing objects of more than few tens of Kbytes when low latency is needed. If you need to import very large GeoJSON geometries in server code, use the much faster and completely parallel fromGeoJonBuffer(Async)
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geojson |
object
|
|
callback |
callback
<
Geometry
>
|
function fromGeoJsonBuffer() src/geometry/gdal_geometry.cpp
Creates a Geometry from a buffer containing a GeoJSON fragment in UT8 format.
Parameter | Type | Description |
---|---|---|
geojson |
Buffer
|
function fromGeoJsonBufferAsync() src/geometry/gdal_geometry.cpp
Creates a Geometry from a buffer containing a GeoJSON fragment in UT8 format.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geojson |
Buffer
|
|
callback |
callback
<
Geometry
>
|
function fromWKB() src/geometry/gdal_geometry.cpp
Creates a Geometry from a WKB buffer.
Parameter | Type | Description |
---|---|---|
wkb |
Buffer
|
|
srs |
SpatialReference
| undefined
|
function fromWKBAsync() src/geometry/gdal_geometry.cpp
Creates a Geometry from a WKB buffer.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
wkb |
Buffer
|
|
srs |
SpatialReference
| undefined
|
|
callback |
callback
<
Geometry
>
|
function fromWKT() src/geometry/gdal_geometry.cpp
Creates a Geometry from a WKT string.
Parameter | Type | Description |
---|---|---|
wkt |
string
|
|
srs |
SpatialReference
| undefined
|
function fromWKTAsync() src/geometry/gdal_geometry.cpp
Creates a Geometry from a WKT string.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
wkt |
string
|
|
srs |
SpatialReference
| undefined
|
|
callback |
callback
<
Geometry
>
|
function getConstructor() src/geometry/gdal_geometry.cpp
Returns the Geometry subclass that matches the given WKB geometry type.
Parameter | Type | Description |
---|---|---|
type |
number
|
WKB geometry type available options |
Function
function getEnvelope() src/geometry/gdal_geometry.cpp
Computes the bounding box (envelope).
Returns Envelope
Bounding envelope
function getEnvelope3D() src/geometry/gdal_geometry.cpp
Computes the 3D bounding box (envelope).
Returns Envelope3D
Bounding envelope
function getEnvelope3DAsync() src/geometry/gdal_geometry.cpp
Computes the 3D bounding box (envelope).
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Geometry
>
|
function getEnvelopeAsync() src/geometry/gdal_geometry.cpp
Computes the bounding box (envelope).
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Envelope
>
|
function getName() src/geometry/gdal_geometry.cpp
Returns the Geometry subclass name that matches the given WKB geometry type.
Parameter | Type | Description |
---|---|---|
type |
number
|
WKB geometry type available options |
string
function intersection() src/geometry/gdal_geometry.cpp
Compute intersection with another geometry.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
function intersectionAsync() src/geometry/gdal_geometry.cpp
Compute intersection with another geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
Geometry
>
|
function intersects() src/geometry/gdal_geometry.cpp
Determines if the two geometries intersect.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function intersectsAsync() src/geometry/gdal_geometry.cpp
Determines if the two geometries intersect.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function isEmpty() src/geometry/gdal_geometry.cpp
Determines if the geometry is empty.
Returns boolean
function isEmptyAsync() src/geometry/gdal_geometry.cpp
Determines if the geometry is empty.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function isRing() src/geometry/gdal_geometry.cpp
Determines if the geometry is a ring.
Returns boolean
function isRingAsync() src/geometry/gdal_geometry.cpp
Determines if the geometry is a ring.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function isSimple() src/geometry/gdal_geometry.cpp
Determines if the geometry is simple.
Returns boolean
function isSimpleAsync() src/geometry/gdal_geometry.cpp
Determines if the geometry is simple.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function isValid() src/geometry/gdal_geometry.cpp
Determines if the geometry is valid.
Returns boolean
function isValidAsync() src/geometry/gdal_geometry.cpp
Determines if the geometry is valid.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function makeValid() src/geometry/gdal_geometry.cpp
Attempts to make an invalid geometry valid without losing vertices. Requires GDAL 3.0
Throws Returnsfunction makeValidAsync() src/geometry/gdal_geometry.cpp
Attempts to make an invalid geometry valid without losing vertices. Requires GDAL 3.0
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
Geometry
>
|
function overlaps() src/geometry/gdal_geometry.cpp
Determines if the current geometry overlaps the provided geometry.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function overlapsAsync() src/geometry/gdal_geometry.cpp
Determines if the current geometry overlaps the provided geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function segmentize() src/geometry/gdal_geometry.cpp
Modify the geometry such it has no segment longer then the given distance.
Parameter | Type | Description |
---|---|---|
segment_length |
number
|
void
function simplify() src/geometry/gdal_geometry.cpp
Reduces the geometry complexity.
Parameter | Type | Description |
---|---|---|
tolerance |
number
|
function simplifyAsync() src/geometry/gdal_geometry.cpp
Reduces the geometry complexity.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
tolerance |
number
|
|
callback |
callback
<
Geometry
>
|
function simplifyPreserveTopology() src/geometry/gdal_geometry.cpp
Reduces the geometry complexity while preserving the topology.
Parameter | Type | Description |
---|---|---|
tolerance |
number
|
function simplifyPreserveTopologyAsync() src/geometry/gdal_geometry.cpp
Reduces the geometry complexity while preserving the topology.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
tolerance |
number
|
|
callback |
callback
<
Geometry
>
|
function swapXY() src/geometry/gdal_geometry.cpp
Swaps x, y coordinates.
function swapXYAsync() src/geometry/gdal_geometry.cpp
Swaps x, y coordinates.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
void
>
|
Promise
<
void
>
function symDifference() src/geometry/gdal_geometry.cpp
Computes the symmetric difference of this geometry and the second geometry.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
function symDifferenceAsync() src/geometry/gdal_geometry.cpp
Computes the symmetric difference of this geometry and the second geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
Geometry
>
|
function toGML() src/geometry/gdal_geometry.cpp
Convert a geometry into GML format.
Throws Returns string
function toGMLAsync() src/geometry/gdal_geometry.cpp
Convert a geometry into GML format.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
string
>
|
Promise
<
string
>
function toJSON() src/geometry/gdal_geometry.cpp
Convert a geometry into JSON format.
Throws Returns string
function toJSONAsync() src/geometry/gdal_geometry.cpp
Convert a geometry into JSON format.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
string
>
|
Promise
<
string
>
function toKML() src/geometry/gdal_geometry.cpp
Convert a geometry into KML format.
Throws Returns string
function toKMLAsync() src/geometry/gdal_geometry.cpp
Convert a geometry into KML format.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
string
>
|
Promise
<
string
>
function touches() src/geometry/gdal_geometry.cpp
Determines if the two geometries touch.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function touchesAsync() src/geometry/gdal_geometry.cpp
Determines if the two geometries touch.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
function toWKB() src/geometry/gdal_geometry.cpp
Convert a geometry into well known binary format.
Parameter | Type | Description |
---|---|---|
byte_order |
string
|
|
variant |
string
|
( see options ) |
Buffer
function toWKBAsync() src/geometry/gdal_geometry.cpp
Convert a geometry into well known binary format.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
byte_order |
string
|
|
variant |
string
|
( see options ) |
callback |
callback
<
Buffer
>
|
Promise
<
Buffer
>
function toWKT() src/geometry/gdal_geometry.cpp
Convert a geometry into well known text format.
Throws Returns string
function toWKTAsync() src/geometry/gdal_geometry.cpp
Convert a geometry into well known text format.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
string
>
|
Promise
<
string
>
function transform() src/geometry/gdal_geometry.cpp
Apply arbitrary coordinate transformation to the geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the CoordinateTransformation object, and the actual SRS of the geometry will be ignored.
Parameter | Type | Description |
---|---|---|
transformation |
CoordinateTransformation
|
function transformAsync() src/geometry/gdal_geometry.cpp
Apply arbitrary coordinate transformation to the geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
transformation |
CoordinateTransformation
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function transformTo() src/geometry/gdal_geometry.cpp
Transforms the geometry to match the provided SpatialReference
Parameter | Type | Description |
---|---|---|
srs |
SpatialReference
|
function transformToAsync() src/geometry/gdal_geometry.cpp
Transforms the geometry to match the provided SpatialReference
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
srs |
SpatialReference
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function union() src/geometry/gdal_geometry.cpp
Compute the union of this geometry with another.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
function unionAsync() src/geometry/gdal_geometry.cpp
Compute the union of this geometry with another.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
Geometry
>
|
function within() src/geometry/gdal_geometry.cpp
Determines if the current geometry is within the provided geometry.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
boolean
function withinAsync() src/geometry/gdal_geometry.cpp
Determines if the current geometry is within the provided geometry.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
|
|
callback |
callback
<
boolean
>
|
Promise
<
boolean
>
class GeometryCollection src/geometry/gdal_geometrycollection.cpp
A collection of 1 or more geometry objects.
children : GeometryCollectionChildren src/geometry/gdal_geometrycollection.cpp
All geometries represented by this collection.
function getArea() src/geometry/gdal_geometrycollection.cpp
Computes the combined area of the geometries.
Returns number
function getLength() src/geometry/gdal_geometrycollection.cpp
Compute the length of a multicurve.
Returns number
class GeometryCollectionChildren src/collections/geometry_collection_children.cpp
A collection of Geometries, used by GeometryCollection .
function add() src/collections/geometry_collection_children.cpp
Adds geometry(s) to the collection.
Parameter | Type | Description |
---|---|---|
geometry |
Geometry
| Array
<
Geometry
>
|
// one at a time:
geometryCollection.children.add(new Point(0,0,0));
// add many at once:
geometryCollection.children.add([
new Point(1,0,0),
new Point(1,0,0)
]);
function count() src/collections/geometry_collection_children.cpp
Returns the number of items.
Returns number
function forEach() lib/default_iterators.js
Iterates through all child geometries using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Geometry
>
|
The callback to be called with each Geometry |
geometryCollection.children.forEach(function(array, i) { ... });
function get() src/collections/geometry_collection_children.cpp
Returns the geometry at the specified index.
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index |
function map() lib/default_iterators.js
Iterates through child geometries using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Geometry
, U
>
|
The callback to be called with each Geometry |
Array
<
U
>
var result = geometryCollection.children.map(function(array, i) {
return value;
});
function prototype() : Geometry lib/default_iterators.js
Iterates through all child geometries using an iterator
Examplefor (const array of geometryCollection.children) {
}
function remove() src/collections/geometry_collection_children.cpp
Removes the geometry at the specified index.
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index, -1 for all geometries |
class CircularString src/geometry/gdal_circularstring.cpp
Concrete representation of an arc.
Examplevar CircularString = new gdal.CircularString();
CircularString.points.add(new gdal.Point(0,0));
CircularString.points.add(new gdal.Point(0,10));
class CompoundCurve src/geometry/gdal_compoundcurve.cpp
Concrete representation of a compound contionuos curve.
Examplevar CompoundCurve = new gdal.CompoundCurve();
CompoundCurve.points.add(new gdal.Point(0,0));
CompoundCurve.points.add(new gdal.Point(0,10));
curves : CompoundCurveCurves src/geometry/gdal_compoundcurve.cpp
Points that make up the compound curve.
class CompoundCurveCurves src/collections/compound_curves.cpp
A collection of connected curves, used by CompoundCurve
function add() src/collections/compound_curves.cpp
Adds a curve to the collection.
Parameter | Type | Description |
---|---|---|
curves |
SimpleCurve
| Array
<
SimpleCurve
>
|
var ring1 = new gdal.CircularString();
ring1.points.add(0,0);
ring1.points.add(1,0);
ring1.points.add(1,1);
ring1.points.add(0,1);
ring1.points.add(0,0);
// one at a time:
compound.curves.add(ring1);
// many at once:
compound.curves.add([ring1, ...]);
function asyncIterator() : SimpleCurve lib/default_iterators.js
Iterates through all curves using an async iterator
Examplefor await (const array of compoundCurves.curves) {
}
function count() src/collections/compound_curves.cpp
Returns the number of curves that exist in the collection.
Returns number
function forEach() lib/default_iterators.js
Iterates through all curves using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
SimpleCurve
>
|
The callback to be called with each SimpleCurve |
compoundCurves.curves.forEach(function(array, i) { ... });
function get() src/collections/compound_curves.cpp
Returns the curve at the specified index.
Parameter | Type | Description |
---|---|---|
index |
number
|
var curve0 = compound.curves.get(0);
var curve1 = compound.curves.get(1);
function map() lib/default_iterators.js
Iterates through curves using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
SimpleCurve
, U
>
|
The callback to be called with each SimpleCurve |
Array
<
U
>
var result = compoundCurves.curves.map(function(array, i) {
return value;
});
function prototype() : SimpleCurve lib/default_iterators.js
Iterates through all curves using an iterator
Examplefor (const array of compoundCurves.curves) {
}
function toArray() lib/default_iterators.js
Outputs all curves as a regular javascript array.
Returns Array
<
SimpleCurve
>
List of SimpleCurve instances
class LinearRing src/geometry/gdal_linearring.cpp
Concrete representation of a closed ring.
function getArea() src/geometry/gdal_linearring.cpp
Computes the area enclosed by the ring.
Returns number
class LineString src/geometry/gdal_linestring.cpp
Concrete representation of a multi-vertex line.
Examplevar lineString = new gdal.LineString();
lineString.points.add(new gdal.Point(0,0));
lineString.points.add(new gdal.Point(0,10));
class LineStringPoints src/collections/linestring_points.cpp
An encapsulation of a LineString 's points.
function add() src/collections/linestring_points.cpp
Adds point(s) to the line string. Also accepts any object with an x and y property.
Parameter | Type | Description |
---|---|---|
points |
Point
| xyz
| Array
<
Point
| xyz
>
|
lineString.points.add(new gdal.Point(1, 2));
lineString.points.add([
new gdal.Point(1, 2)
new gdal.Point(3, 4)
]);
function add() src/collections/linestring_points.cpp
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
z |
number
| undefined
|
function count() src/collections/linestring_points.cpp
Returns the number of points that are part of the line string.
Returns number
function forEach() lib/default_iterators.js
Iterates through all points using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Point
>
|
The callback to be called with each Point |
lineString.points.forEach(function(array, i) { ... });
function get() src/collections/linestring_points.cpp
Returns the point at the specified index.
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index |
function map() lib/default_iterators.js
Iterates through points using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Point
, U
>
|
The callback to be called with each Point |
Array
<
U
>
var result = lineString.points.map(function(array, i) {
return value;
});
function prototype() : Point lib/default_iterators.js
Iterates through all points using an iterator
Examplefor (const array of lineString.points) {
}
function resize() src/collections/linestring_points.cpp
Adjusts the number of points that make up the line string.
Parameter | Type | Description |
---|---|---|
count |
number
|
function reverse() src/collections/linestring_points.cpp
Reverses the order of all the points.
function set() src/collections/linestring_points.cpp
Sets the point at the specified index.
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index |
point |
Point
| xyz
|
lineString.points.set(0, new gdal.Point(1, 2));
function set() src/collections/linestring_points.cpp
Parameter | Type | Description |
---|---|---|
index |
number
|
0-based index |
x |
number
|
|
y |
number
|
|
z |
number
| undefined
|
function toArray() lib/default_iterators.js
Outputs all points as a regular javascript array.
Returns Array
<
Point
>
List of Point instances
class MultiCurve src/geometry/gdal_multicurve.cpp
function polygonize() src/geometry/gdal_multicurve.cpp
Converts it to a polygon.
Returnsclass MultiLineString src/geometry/gdal_multilinestring.cpp
function polygonize() src/geometry/gdal_multilinestring.cpp
Converts it to a polygon.
Returnsclass MultiPoint src/geometry/gdal_multipoint.cpp
class MultiPolygon src/geometry/gdal_multipolygon.cpp
function getArea() src/geometry/gdal_multipolygon.cpp
Computes the combined area of the collection.
Returns number
function unionCascaded() src/geometry/gdal_multipolygon.cpp
Unions all the geometries and returns the result.
Returnsclass Point src/geometry/gdal_point.cpp
Point class.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
z |
number
| undefined
|
x : number src/geometry/gdal_point.cpp
y : number src/geometry/gdal_point.cpp
z : number src/geometry/gdal_point.cpp
class Polygon src/geometry/gdal_polygon.cpp
Concrete class representing polygons.
rings : PolygonRings src/geometry/gdal_polygon.cpp
The rings that make up the polygon geometry.
function getArea() src/geometry/gdal_polygon.cpp
Computes the area of the polygon.
Returns number
class PolygonRings src/collections/polygon_rings.cpp
A collection of polygon rings, used by Polygon .
function add() src/collections/polygon_rings.cpp
Adds a ring to the collection.
Parameter | Type | Description |
---|---|---|
rings |
LinearRing
| Array
<
LinearRing
>
|
var ring1 = new gdal.LinearRing();
ring1.points.add(0,0);
ring1.points.add(1,0);
ring1.points.add(1,1);
ring1.points.add(0,1);
ring1.points.add(0,0);
// one at a time:
polygon.rings.add(ring1);
// many at once:
polygon.rings.add([ring1, ...]);
function count() src/collections/polygon_rings.cpp
Returns the number of rings that exist in the collection.
Returns number
function forEach() lib/default_iterators.js
Iterates through all rings using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
LineString
>
|
The callback to be called with each LineString |
polygon.rings.forEach(function(array, i) { ... });
function get() src/collections/polygon_rings.cpp
Returns the ring at the specified index. The ring
at index
0
will always be the polygon's exterior ring.
Parameter | Type | Description |
---|---|---|
index |
number
|
var exterior = polygon.rings.get(0);
var interior = polygon.rings.get(1);
function map() lib/default_iterators.js
Iterates through rings using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
LineString
, U
>
|
The callback to be called with each LineString |
Array
<
U
>
var result = polygon.rings.map(function(array, i) {
return value;
});
function prototype() : LineString lib/default_iterators.js
Iterates through all rings using an iterator
Examplefor (const array of polygon.rings) {
}
function toArray() lib/default_iterators.js
Outputs all rings as a regular javascript array.
Returns Array
<
LineString
>
List of LineString instances
class SimpleCurve src/geometry/gdal_simplecurve.cpp
Abstract class representing all SimpleCurves.
function addSubLineString() src/geometry/gdal_simplecurve.cpp
Add a segment of another LineString to this SimpleCurve subtype.
Adds the request range of vertices to the end of this compound curve in an efficient manner. If the start index is larger than the end index then the vertices will be reversed as they are copied.
Parameter | Type | Description |
---|---|---|
LineString |
LineString
|
to be added |
start |
number
|
the first vertex to copy, defaults to 0 to start with the first vertex in the other LineString |
end |
number
|
the last vertex to copy, defaults to -1 indicating the last vertex of the other LineString |
void
function getLength() src/geometry/gdal_simplecurve.cpp
Compute the length of a multiSimpleCurve.
Returns number
function value() src/geometry/gdal_simplecurve.cpp
Returns the point at the specified distance along the SimpleCurve.
Parameter | Type | Description |
---|---|---|
distance |
number
|
class Envelope lib/envelope.js
A 2D bounding box. For 3D envelopes, see Envelope3D
(Pure-javascript implementation of OGREnvelope )
Parameter | Type | Description |
---|---|---|
bounds |
object
| undefined
|
An object containing
|
Property | Type | Description |
---|---|---|
minX
|
number
|
|
maxX
|
number
|
|
minY
|
number
|
|
maxY
|
number
|
function contains() lib/envelope.js
Determines if the provided envelope is wholly-contained by the current envelope.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope
|
boolean
function intersect() lib/envelope.js
Updates the envelope to the intersection of the two envelopes.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope
|
void
function intersects() lib/envelope.js
Determines if the provided envelope touches it.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope
|
boolean
function isEmpty() lib/envelope.js
Determines if the envelope has not been set yet.
Returns boolean
function merge() lib/envelope.js
Unions the provided envelope with the current envelope.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope
|
void
function merge() lib/envelope.js
Unions the provided envelope with the x/y coordinates provided.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
void
function toPolygon() lib/envelope.js
Converts the envelope to a polygon.
Returnsclass Envelope3D lib/envelope_3d.js
A 3D bounding box. For 2D envelopes, see Envelope
(Pure-javascript implementation of OGREnvelope3D )
Parameter | Type | Description |
---|---|---|
bounds |
object
| undefined
|
An object containing
|
Property | Type | Description |
---|---|---|
minX
|
number
|
|
maxX
|
number
|
|
minY
|
number
|
|
maxY
|
number
|
|
minZ
|
number
|
|
maxZ
|
number
|
function contains() lib/envelope_3d.js
Determines if the provided envelope is wholly-contained by the current envelope.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope3D
|
boolean
function intersect() lib/envelope_3d.js
Updates the envelope to the intersection of the two envelopes.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope3D
|
void
function intersects() lib/envelope_3d.js
Determines if the provided envelope touches it.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope3D
|
boolean
function isEmpty() lib/envelope_3d.js
Determines if the envelope has not been set yet.
Returns boolean
function merge() lib/envelope_3d.js
Unions the provided envelope with the current envelope.
Parameter | Type | Description |
---|---|---|
envelope |
Envelope3D
|
void
function merge() lib/envelope_3d.js
Unions the provided envelope with the x/y/z coordinates provided.
Parameter | Type | Description |
---|---|---|
x |
number
|
|
y |
number
|
|
z |
number
|
void
Multi-Dimensional Model
Classes for working with the Multi-Dimensional Data Model
class ArrayAttributes src/collections/array_attributes.cpp
An encapsulation of a Array descendant attributes.
ds src/collections/array_attributes.cpp
Returns the parent dataset.
names : Array < string > src/collections/array_attributes.cpp
Attributes' names.
function asyncIterator() : Attribute lib/default_iterators.js
Iterates through all attributes using an async iterator
Examplefor await (const array of array.attributes) {
}
function count() src/collections/array_attributes.cpp
Returns the number of attributes in the collection.
Returns number
function countAsync() src/collections/array_attributes.cpp
Returns the number of attributes in the collection.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all attributes using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Attribute
>
|
The callback to be called with each Attribute |
array.attributes.forEach(function(array, i) { ... });
function get() src/collections/array_attributes.cpp
Returns the attribute with the given name/index.
Parameter | Type | Description |
---|---|---|
attribute |
string
| number
|
function getAsync() src/collections/array_attributes.cpp
Returns the attribute with the given name/index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
attribute |
string
| number
|
|
callback |
callback
<
Attribute
>
|
function map() lib/default_iterators.js
Iterates through attributes using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Attribute
, U
>
|
The callback to be called with each Attribute |
Array
<
U
>
var result = array.attributes.map(function(array, i) {
return value;
});
function prototype() : Attribute lib/default_iterators.js
Iterates through all attributes using an iterator
Examplefor (const array of array.attributes) {
}
class ArrayDimensions src/collections/array_dimensions.cpp
An encapsulation of a MDArray descendant dimensions.
Exampleconst dimensions = group.dimensions;
ds : Dataset src/collections/array_dimensions.cpp
Returns the parent dataset.
names : Array < string > src/collections/array_dimensions.cpp
Dimensions' names.
parent : Group src/collections/array_dimensions.cpp
Returns the parent group.
function asyncIterator() : Dimension lib/default_iterators.js
Iterates through all dimensions using an async iterator
Examplefor await (const array of array.dimensions) {
}
function count() src/collections/array_dimensions.cpp
Returns the number of dimensions in the collection.
Returns number
function countAsync() src/collections/array_dimensions.cpp
Returns the number of dimensions in the collection.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all dimensions using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Dimension
>
|
The callback to be called with each Dimension |
array.dimensions.forEach(function(array, i) { ... });
function get() src/collections/array_dimensions.cpp
Returns the array with the given name/index.
Parameter | Type | Description |
---|---|---|
array |
string
| number
|
function getAsync() src/collections/array_dimensions.cpp
Returns the array with the given name/index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
array |
string
| number
|
|
callback |
callback
<
Dimension
>
|
function map() lib/default_iterators.js
Iterates through dimensions using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Dimension
, U
>
|
The callback to be called with each Dimension |
Array
<
U
>
var result = array.dimensions.map(function(array, i) {
return value;
});
function prototype() : Dimension lib/default_iterators.js
Iterates through all dimensions using an iterator
Examplefor (const array of array.dimensions) {
}
class Attribute src/gdal_attribute.cpp
A representation of a group with access methods.
dataType : string src/gdal_attribute.cpp
value : string | number src/gdal_attribute.cpp
Complex GDAL data types introduced in 3.1 are not yet supported
Throwsclass Dimension src/gdal_dimension.cpp
A representation of a group with access methods.
description : string src/gdal_dimension.cpp
direction : string src/gdal_dimension.cpp
size : number src/gdal_dimension.cpp
type : string src/gdal_dimension.cpp
class Group src/gdal_group.cpp
A representation of a group with access methods.
arrays : GroupArrays src/gdal_group.cpp
attributes : GroupAttributes src/gdal_group.cpp
description : string src/gdal_group.cpp
dimensions : GroupDimensions src/gdal_group.cpp
groups : GroupGroups src/gdal_group.cpp
class GroupArrays src/collections/group_arrays.cpp
An encapsulation of a Group descendant arrays.
ds : Dataset src/collections/group_arrays.cpp
Returns the parent dataset.
names : Array < string > src/collections/group_arrays.cpp
function asyncIterator() : MDArray lib/default_iterators.js
Iterates through all arrays using an async iterator
Examplefor await (const array of group.arrays) {
}
function count() src/collections/group_arrays.cpp
Returns the number of arrays in the collection.
Returns number
function countAsync() src/collections/group_arrays.cpp
Returns the number of arrays in the collection.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all arrays using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
MDArray
>
|
The callback to be called with each MDArray |
group.arrays.forEach(function(array, i) { ... });
function get() src/collections/group_arrays.cpp
Returns the array with the given name/index.
Parameter | Type | Description |
---|---|---|
array |
string
| number
|
function getAsync() src/collections/group_arrays.cpp
Returns the array with the given name/index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
array |
string
| number
|
|
callback |
callback
<
MDArray
>
|
function map() lib/default_iterators.js
Iterates through arrays using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
MDArray
, U
>
|
The callback to be called with each MDArray |
Array
<
U
>
var result = group.arrays.map(function(array, i) {
return value;
});
function prototype() : MDArray lib/default_iterators.js
Iterates through all arrays using an iterator
Examplefor (const array of group.arrays) {
}
class GroupAttributes src/collections/group_attributes.cpp
An encapsulation of a Group descendant attributes.
ds : Dataset src/collections/group_attributes.cpp
Returns the parent dataset.
names : Array < string > src/collections/group_attributes.cpp
function asyncIterator() : Attribute lib/default_iterators.js
Iterates through all attributes using an async iterator
Examplefor await (const array of group.attributes) {
}
function count() src/collections/group_attributes.cpp
Returns the number of attributes in the collection.
Returns number
function countAsync() src/collections/group_attributes.cpp
Returns the number of attributes in the collection.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all attributes using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Attribute
>
|
The callback to be called with each Attribute |
group.attributes.forEach(function(array, i) { ... });
function get() src/collections/group_attributes.cpp
Returns the attribute with the given name/index.
Parameter | Type | Description |
---|---|---|
attribute |
string
| number
|
function getAsync() src/collections/group_attributes.cpp
Returns the attribute with the given name/index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
attribute |
string
| number
|
|
callback |
callback
<
Attribute
>
|
function map() lib/default_iterators.js
Iterates through attributes using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Attribute
, U
>
|
The callback to be called with each Attribute |
Array
<
U
>
var result = group.attributes.map(function(array, i) {
return value;
});
function prototype() : Attribute lib/default_iterators.js
Iterates through all attributes using an iterator
Examplefor (const array of group.attributes) {
}
class GroupDimensions src/collections/group_dimensions.cpp
An encapsulation of a Group descendant dimensions.
Exampleconst dimensions = group.dimensions;
ds : Dataset src/collections/group_dimensions.cpp
Returns the parent dataset.
names : Array < string > src/collections/group_dimensions.cpp
function asyncIterator() : Dimension lib/default_iterators.js
Iterates through all dimensions using an async iterator
Examplefor await (const array of group.dimensions) {
}
function count() src/collections/group_dimensions.cpp
Returns the number of dimensions in the collection.
Returns number
function countAsync() src/collections/group_dimensions.cpp
Returns the number of dimensions in the collection.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all dimensions using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Dimension
>
|
The callback to be called with each Dimension |
group.dimensions.forEach(function(array, i) { ... });
function get() src/collections/group_dimensions.cpp
Returns the array with the given name/index.
Parameter | Type | Description |
---|---|---|
array |
string
| number
|
function getAsync() src/collections/group_dimensions.cpp
Returns the array with the given name/index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
array |
string
| number
|
|
callback |
callback
<
Dimension
>
|
function map() lib/default_iterators.js
Iterates through dimensions using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Dimension
, U
>
|
The callback to be called with each Dimension |
Array
<
U
>
var result = group.dimensions.map(function(array, i) {
return value;
});
function prototype() : Dimension lib/default_iterators.js
Iterates through all dimensions using an iterator
Examplefor (const array of group.dimensions) {
}
class GroupGroups src/collections/group_groups.cpp
An encapsulation of a Group descendant groups.
ds : Dataset src/collections/group_groups.cpp
Returns the parent dataset.
names : Array < string > src/collections/group_groups.cpp
function asyncIterator() : Group lib/default_iterators.js
Iterates through all groups using an async iterator
Examplefor await (const array of group.groups) {
}
function count() src/collections/group_groups.cpp
Returns the number of groups in the collection.
Returns number
function countAsync() src/collections/group_groups.cpp
Returns the number of groups in the collection.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
callback |
callback
<
number
>
|
Promise
<
number
>
function forEach() lib/default_iterators.js
Iterates through all groups using a callback function.
Parameter | Type | Description |
---|---|---|
callback |
forEachCb
<
Group
>
|
The callback to be called with each Group |
group.groups.forEach(function(array, i) { ... });
function get() src/collections/group_groups.cpp
Returns the group with the given name/index.
Parameter | Type | Description |
---|---|---|
group |
string
| number
|
function getAsync() src/collections/group_groups.cpp
Returns the group with the given name/index.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
group |
string
| number
|
|
callback |
callback
<
Group
>
|
function map() lib/default_iterators.js
Iterates through groups using a callback function and builds an array of the returned values.
Parameter | Type | Description |
---|---|---|
callback |
mapCb
<
Group
, U
>
|
The callback to be called with each Group |
Array
<
U
>
var result = group.groups.map(function(array, i) {
return value;
});
function prototype() : Group lib/default_iterators.js
Iterates through all groups using an iterator
Examplefor (const array of group.groups) {
}
class MDArray src/gdal_mdarray.cpp
A representation of an array with access methods.
attributes : ArrayAttributes src/gdal_mdarray.cpp
dataType : string src/gdal_mdarray.cpp
description : string src/gdal_mdarray.cpp
dimensions : GroupDimensions src/gdal_mdarray.cpp
length : number src/gdal_mdarray.cpp
The flattened length of the array.
noDataValue : number | null src/gdal_mdarray.cpp
No data value for this array.
offset : number src/gdal_mdarray.cpp
Raster value offset.
scale : number src/gdal_mdarray.cpp
Raster value scale.
srs : SpatialReference src/gdal_mdarray.cpp
Spatial reference associated with MDArray.
ThrowsunitType : string src/gdal_mdarray.cpp
Raster unit type (name for the units of this raster's values).
For instance, it might be
"m"
for an elevation model in meters,
or
"ft"
for feet. If no units are available, a value of
""
will be returned.
function asDataset() src/gdal_mdarray.cpp
Return a view of this array as a gdal.Dataset (ie 2D)
In the case of > 2D arrays, additional dimensions will be represented as raster bands.
Parameter | Type | Description |
---|---|---|
x |
number
| string
|
dimension to be used as X axis |
y |
number
| string
|
dimension to be used as Y axis |
function getMask() src/gdal_mdarray.cpp
Return an array that is a mask for the current array.
This array will be of type Byte, with values set to 0 to indicate invalid pixels of the current array, and values set to 1 to indicate valid pixels.
The generic implementation honours the NoDataValue, as well as various netCDF CF attributes: missing_value, _FillValue, valid_min, valid_max and valid_range.
Throws Returnsfunction getView() src/gdal_mdarray.cpp
Get a partial view of the MDArray.
The slice expression uses the same syntax as NumPy basic slicing and indexing. See ( https://www.numpy.org/devdocs/reference/arrays.indexing.html#basic-slicing-and-indexing ). Or it can use field access by name. See ( https://www.numpy.org/devdocs/reference/arrays.indexing.html#field-access ).
Parameter | Type | Description |
---|---|---|
view |
string
|
function read() src/gdal_mdarray.cpp
Read data from the MDArray.
This will extract the context of a (hyper-)rectangle from the array into a buffer. If the buffer can be passed as an argument or it can be allocated by the function. Generalized n-dimensional strides are supported.
Although this method can be used in its raw form, it works best when used with the ndarray plugin.
Parameter | Type | Description |
---|---|---|
options |
MDArrayOptions
|
function readAsync() src/gdal_mdarray.cpp
Read data from the MDArray.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
MDArrayOptions
|
|
callback |
callback
<
TypedArray
>
|
Promise
<
TypedArray
>
A
TypedArray
of values.
Streams
Raster Data Integration with Node.js Streams
class RasterMuxStream lib/multiplexer.js
Multiplexer stream
Reads multiple input RasterReadStream streams and outputs a single} synchronized stream with multiple data elements.
All the input streams must have the same length.
Can be used with RasterTransform which will automatically apply a function over the whole chunk.
Parameter | Type | Description |
---|---|---|
inputs |
Record
<
string
, RasterReadStream
>
|
Input streams |
options |
RasterReadableOptions
| undefined
|
const dsT2m = gdal.open('AROME_T2m_10.tiff'));
const dsD2m = gdal.open('AROME_D2m_10.tiff'));
const dsCloudBase = gdal.open('CLOUDBASE.tiff', 'w', 'GTiff',
dsT2m.rasterSize.x, dsT2m.rasterSize.y, 1, gdal.GDT_Float64);
const mux = new gdal.RasterMuxStream({
T2m: dsT2m.bands.get(1).pixels.createReadStream(),
D2m: dsD2m.bands.get(1).pixels.createReadStream()
});
const ws = dsCloudBase.bands.get(1).pixels.createWriteStream();
// Espy's estimation for cloud base height (lifted condensation level)
// LCL = 125 * (T2m - Td2m)
// where T2m is the temperature at 2m and Td2m is the dew point at 2m
const espyEstimation = new Transform({
objectMode: true,
transform(chunk, _, cb) {
const lcl = new Float64Array(chunk.T2m.length)
for (let i = 0; i < chunk.T2m.length; i++) {
lcl[i] = 125 * (chunk.T2m[i] - chunk.D2m[i])
}
cb(null, lcl)
}
})
mux.pipe(espyEstimation).pipe(ws);
class RasterReadStream lib/readable.js
Class implementing RasterBand reading as a stream of pixels}
Reading is buffered and it is aligned on the underlying compression blocks for maximum efficiency when possible
Pixels are streamed in row-major order
Parameter | Type | Description |
---|---|---|
options |
RasterReadableOptions
| undefined
|
class RasterTransform lib/multiplexer.js
A raster Transform stream
Applies a function on all data elements.
Input must be a RasterMuxStream
calcAsync
provides a higher-level interface for the same feature, while
an even lower-level API is available by manually extending
stream.Transform
as illustrated
in the
gdal.RasterMuxStream
example.
Parameter | Type | Description |
---|---|---|
options |
RasterTransformOptions
| undefined
|
const dsT2m = gdal.open('AROME_T2m_10.tiff'));
const dsD2m = gdal.open('AROME_D2m_10.tiff'));
const dsCloudBase = gdal.open('CLOUDBASE.tiff', 'w', 'GTiff',
dsT2m.rasterSize.x, dsT2m.rasterSize.y, 1, gdal.GDT_Float64);
const mux = new gdal.RasterMuxStream({
T2m: dsT2m.bands.get(1).pixels.createReadStream(),
D2m: dsD2m.bands.get(1).pixels.createReadStream()
});
const ws = dsCloudBase.bands.get(1).pixels.createWriteStream();
// Espy's estimation for cloud base height (lifted condensation level)
// LCL = 125 * (T2m - Td2m)
// where T2m is the temperature at 2m and Td2m is the dew point at 2m
const fn = (t,td) => 125 * (t - td);
const espyEstimation = new RasterTransform({ type: Float64Array, fn });
mux.pipe(espyEstimation).pipe(ws);
class RasterWriteStream lib/writable.js
Class implementing RasterBand writing as a stream of pixels
Writing is buffered and it is aligned on the underlying compression blocks for maximum efficiency when possible
When piping between rasters using identical blocks, the transfer is zero-copy
The input stream must be in row-major order
If the data type of the stream is different from the data type of the file, GDAL will automatically convert. Mixing data types across chunks is not supported, all chunks must have the same type.
Writing is zero-copy when writing chunks that are exact
multiples of the underlying stream block size as returned
by
gdal.RasterBandPixels.blockSize
Block are written only when full, so the stream must
receive exactly
width * height
pixels to write the last block
Parameter | Type | Description |
---|---|---|
options |
RasterWritableOptions
| undefined
|
Constants
All constants
CPL Error Codes
constant CE_Debug : number src/node_gdal.cpp
Error level: Debug
constant CE_Failure : number src/node_gdal.cpp
Error level: Failure
constant CE_Fatal : number src/node_gdal.cpp
Error level: Fatal
constant CE_None : number src/node_gdal.cpp
Error level: (no error)
constant CE_Warning : number src/node_gdal.cpp
Error level: Warning
constant CPLE_AppDefined : number src/node_gdal.cpp
constant CPLE_AssertionFailed : number src/node_gdal.cpp
constant CPLE_FileIO : number src/node_gdal.cpp
constant CPLE_IllegalArg : number src/node_gdal.cpp
constant CPLE_None : number src/node_gdal.cpp
constant CPLE_NotSupported : number src/node_gdal.cpp
constant CPLE_NoWriteAccess : number src/node_gdal.cpp
constant CPLE_objectNull : number src/node_gdal.cpp
constant CPLE_OpenFailed : number src/node_gdal.cpp
constant CPLE_OutOfMemory : number src/node_gdal.cpp
constant CPLE_UserInterrupt : number src/node_gdal.cpp
Dataset creation
constant DCAP_CREATE : string src/node_gdal.cpp
constant DCAP_CREATECOPY : string src/node_gdal.cpp
constant DCAP_VIRTUALIO : string src/node_gdal.cpp
Dimensions
constant DIM_HORIZONTAL_X : string src/node_gdal.cpp
constant DIM_HORIZONTAL_Y : string src/node_gdal.cpp
constant DIM_PARAMETRIC : string src/node_gdal.cpp
constant DIM_TEMPORAL : string src/node_gdal.cpp
constant DIM_VERTICAL : string src/node_gdal.cpp
constant DIR_DOWN : string src/node_gdal.cpp
constant DIR_EAST : string src/node_gdal.cpp
constant DIR_FUTURE : string src/node_gdal.cpp
constant DIR_NORTH : string src/node_gdal.cpp
constant DIR_PAST : string src/node_gdal.cpp
constant DIR_SOUTH : string src/node_gdal.cpp
constant DIR_UP : string src/node_gdal.cpp
constant DIR_WEST : string src/node_gdal.cpp
DMD
constant DMD_CREATIONDATATYPES : string src/node_gdal.cpp
constant DMD_CREATIONOPTIONLIST : string src/node_gdal.cpp
constant DMD_EXTENSION : string src/node_gdal.cpp
constant DMD_HELPTOPIC : string src/node_gdal.cpp
constant DMD_LONGNAME : string src/node_gdal.cpp
constant DMD_MIMETYPE : string src/node_gdal.cpp
IO Flags
constant GA_Readonly : number src/node_gdal.cpp
constant GA_Update : number src/node_gdal.cpp
constant GF_Read : number src/node_gdal.cpp
constant GF_Write : number src/node_gdal.cpp
Color Interpretation
constant GCI_AlphaBand : string src/node_gdal.cpp
constant GCI_BlackBand : string src/node_gdal.cpp
constant GCI_BlueBand : string src/node_gdal.cpp
constant GCI_CyanBand : string src/node_gdal.cpp
constant GCI_GrayIndex : string src/node_gdal.cpp
constant GCI_GreenBand : string src/node_gdal.cpp
constant GCI_HueBand : string src/node_gdal.cpp
constant GCI_LightnessBand : string src/node_gdal.cpp
constant GCI_MagentaBand : string src/node_gdal.cpp
constant GCI_PaletteIndex : string src/node_gdal.cpp
constant GCI_RedBand : string src/node_gdal.cpp
constant GCI_SaturationBand : string src/node_gdal.cpp
constant GCI_Undefined : string src/node_gdal.cpp
constant GCI_YCbCr_CbBand : string src/node_gdal.cpp
constant GCI_YCbCr_CrBand : string src/node_gdal.cpp
constant GCI_YCbCr_YBand : string src/node_gdal.cpp
constant GCI_YellowBand : string src/node_gdal.cpp
constant GPI_CMYK : string src/node_gdal.cpp
CMYK
constant GPI_Gray : string src/node_gdal.cpp
Grayscale, only c1 defined
constant GPI_HLS : string src/node_gdal.cpp
HLS, c4 is not defined
constant GPI_RGB : string src/node_gdal.cpp
RGBA, alpha in c4
Pixel Types
constant GDT_Byte : string src/node_gdal.cpp
Eight bit unsigned integer
constant GDT_CFloat32 : string src/node_gdal.cpp
Complex Float32
constant GDT_CFloat64 : string src/node_gdal.cpp
Complex Float64
constant GDT_CInt16 : string src/node_gdal.cpp
Complex Int16
constant GDT_CInt32 : string src/node_gdal.cpp
Complex Int32
constant GDT_Float32 : string src/node_gdal.cpp
Thirty two bit floating point
constant GDT_Float64 : string src/node_gdal.cpp
Sixty four bit floating point
constant GDT_Int16 : string src/node_gdal.cpp
Sixteen bit signed integer
constant GDT_Int32 : string src/node_gdal.cpp
Thirty two bit signed integer
constant GDT_UInt16 : string src/node_gdal.cpp
Sixteen bit unsigned integer
constant GDT_UInt32 : string src/node_gdal.cpp
Thirty two bit unsigned integer
constant GDT_Unknown : string src/node_gdal.cpp
Unknown or unspecified type
constant GEDTC_Compound : string src/node_gdal.cpp
String extended type for MDArrays (GDAL >= 3.1)
constant GEDTC_String : string src/node_gdal.cpp
String extended type for MDArrays (GDAL >= 3.1)
Resampling Algorithms
constant GRA_Average : string src/node_gdal.cpp
constant GRA_Bilinear : string src/node_gdal.cpp
constant GRA_Cubic : string src/node_gdal.cpp
constant GRA_CubicSpline : string src/node_gdal.cpp
constant GRA_Lanczos : string src/node_gdal.cpp
constant GRA_Mode : string src/node_gdal.cpp
constant GRA_NearestNeighbor : string src/node_gdal.cpp
ODsCC
constant ODrCCreateDataSource : string src/node_gdal.cpp
constant ODrCDeleteDataSource : string src/node_gdal.cpp
constant ODsCCreateGeomFieldAfterCreateLayer : string src/node_gdal.cpp
constant ODsCCreateLayer : string src/node_gdal.cpp
constant ODsCDeleteLayer : string src/node_gdal.cpp
Feature Field Types
constant OFTBinary : string src/node_gdal.cpp
constant OFTDate : string src/node_gdal.cpp
constant OFTDateTime : string src/node_gdal.cpp
constant OFTInteger : string src/node_gdal.cpp
constant OFTInteger64 : string src/node_gdal.cpp
constant OFTInteger64List : string src/node_gdal.cpp
constant OFTIntegerList : string src/node_gdal.cpp
constant OFTReal : string src/node_gdal.cpp
constant OFTRealList : string src/node_gdal.cpp
constant OFTString : string src/node_gdal.cpp
constant OFTStringList : string src/node_gdal.cpp
constant OFTTime : string src/node_gdal.cpp
constant OFTWideString : string src/node_gdal.cpp
constant OFTWideStringList : string src/node_gdal.cpp
Justification
constant OJLeft : string src/node_gdal.cpp
constant OJRight : string src/node_gdal.cpp
constant OJUndefined : string src/node_gdal.cpp
OLC
constant OLCAlterFieldDefn : string src/node_gdal.cpp
constant OLCCreateField : string src/node_gdal.cpp
constant OLCCreateGeomField : string src/node_gdal.cpp
constant OLCDeleteFeature : string src/node_gdal.cpp
constant OLCDeleteField : string src/node_gdal.cpp
constant OLCFastFeatureCount : string src/node_gdal.cpp
constant OLCFastGetExtent : string src/node_gdal.cpp
constant OLCFastSetNextByIndex : string src/node_gdal.cpp
constant OLCFastSpatialFilter : string src/node_gdal.cpp
constant OLCIgnoreFields : string src/node_gdal.cpp
constant OLCRandomRead : string src/node_gdal.cpp
constant OLCRandomWrite : string src/node_gdal.cpp
constant OLCReorderFields : string src/node_gdal.cpp
constant OLCSequentialWrite : string src/node_gdal.cpp
constant OLCStringsAsUTF8 : string src/node_gdal.cpp
constant OLCTransactions : string src/node_gdal.cpp
wkbGeometryType
constant wkb25DBit : number src/node_gdal.cpp
Example// 2 -> 2.5D
wkbPoint25D = gdal.wkbPoint | gdal.wkb25DBit
// 2.5D -> 2D (same as wkbFlatten())
wkbPoint = gdal.wkbPoint25D & (~gdal.wkb25DBit)
constant wkbCircularString : number src/node_gdal.cpp
constant wkbCompoundCurve : number src/node_gdal.cpp
constant wkbGeometryCollection : number src/node_gdal.cpp
constant wkbGeometryCollection25D : number src/node_gdal.cpp
constant wkbLinearRing : string src/node_gdal.cpp
constant wkbLinearRing25D : number src/node_gdal.cpp
constant wkbLineString : number src/node_gdal.cpp
constant wkbLineString25D : number src/node_gdal.cpp
constant wkbMultiCurve : number src/node_gdal.cpp
constant wkbMultiLineString : number src/node_gdal.cpp
constant wkbMultiLineString25D : number src/node_gdal.cpp
constant wkbMultiPoint : number src/node_gdal.cpp
constant wkbMultiPoint25D : number src/node_gdal.cpp
constant wkbMultiPolygon : number src/node_gdal.cpp
constant wkbMultiPolygon25D : number src/node_gdal.cpp
wkbByteOrder
constant wkbNDR : string src/node_gdal.cpp
constant wkbXDR : string src/node_gdal.cpp
constant wkbNone : number src/node_gdal.cpp
constant wkbPoint : number src/node_gdal.cpp
constant wkbPoint25D : number src/node_gdal.cpp
constant wkbPolygon : number src/node_gdal.cpp
constant wkbPolygon25D : number src/node_gdal.cpp
constant wkbUnknown : number src/node_gdal.cpp
wkbVariant
constant wkbVariantIso : string src/node_gdal.cpp
SFSQL 1.2 and ISO SQL/MM Part 3 extended dimension (Z&M) WKB types.
constant wkbVariantOgc : string src/node_gdal.cpp
Old-style 99-402 extended dimension (Z) WKB types. Synonymous with 'wkbVariantOldOgc' (gdal >= 2.0)
constant wkbVariantOldOgc : string src/node_gdal.cpp
Old-style 99-402 extended dimension (Z) WKB types. Synonymous with 'wkbVariantOgc' (gdal < 2.0)
Data Types
typedef forEachCb : Function lib/iterators.js
typedef mapCb : Function lib/default_iterators.js
Parameter | Type | Description |
---|---|---|
object |
T
|
|
index |
number
|
U
typedef callback : Function lib/gdal.js
Callback using the standard Node.js error convention
Parameter | Type | Description |
---|---|---|
err |
Error
|
|
result |
any
|
typedef stats : object src/gdal_rasterband.cpp
Property | Type | Description |
---|---|---|
min
|
number
|
|
max
|
number
|
|
mean
|
number
|
|
std_dev
|
number
|
typedef units : object src/gdal_spatial_reference.cpp
Property | Type | Description |
---|---|---|
units
|
string
|
|
value
|
number
|
interface xyz lib/gdal.js
Property | Type | Description |
---|---|---|
x
|
number
|
|
y
|
number
|
|
z
|
number
| undefined
|
interface RasterReadableOptions lib/readable.js
Property | Type | Description |
---|---|---|
blockOptimize
|
boolean
| undefined
|
|
convertNoData
|
boolean
| undefined
|
interface RasterWritableOptions lib/writable.js
Property | Type | Description |
---|---|---|
blockOptimize
|
boolean
| undefined
|
|
convertNoData
|
boolean
| undefined
|
interface RasterTransformOptions lib/multiplexer.js
Property | Type | Description |
---|---|---|
fn
|
Function
|
Function to be applied on all data |
typedef CalcOptions : object lib/calc.js
Property | Type | Description |
---|---|---|
convertNoData
|
boolean
| undefined
|
|
convertInput
|
boolean
| undefined
|
|
progress_cb
|
ProgressCb
| undefined
|
typedef ContourOptions : object src/gdal_algorithms.cpp
Property | Type | Description |
---|---|---|
src
|
RasterBand
|
|
dst
|
Layer
|
|
offset
|
number
| undefined
|
|
interval
|
number
| undefined
|
|
fixedLevels
|
Array
<
number
>
| undefined
|
|
nodata
|
number
| undefined
|
|
idField
|
number
| undefined
|
|
elevField
|
number
| undefined
|
|
progress_cb
|
ProgressCb
| undefined
|
typedef CreateOptions : object src/gdal_driver.cpp
Property | Type | Description |
---|---|---|
progress_cb
|
ProgressCb
| undefined
|
typedef FillOptions : object src/gdal_algorithms.cpp
Property | Type | Description |
---|---|---|
src
|
RasterBand
|
|
mask
|
RasterBand
| undefined
|
|
searchDist
|
number
|
|
smoothingIterations
|
number
| undefined
|
typedef MDArrayOptions : object src/gdal_mdarray.cpp
Property | Type | Description |
---|---|---|
origin
|
Array
<
number
>
|
|
span
|
Array
<
number
>
|
|
stride
|
Array
<
number
>
| undefined
|
|
data_type
|
string
| undefined
|
|
data
|
TypedArray
| undefined
|
|
_offset
|
number
| undefined
|
typedef PixelFunction : Uint8Array src/gdal_algorithms.cpp
typedef PolygonizeOptions : object src/gdal_algorithms.cpp
Property | Type | Description |
---|---|---|
src
|
RasterBand
|
|
dst
|
Layer
|
|
mask
|
RasterBand
| undefined
|
|
pixValField
|
number
|
The attribute field index indicating the feature attribute into which the pixel value of the polygon should be written. |
connectedness
|
number
| undefined
|
Either 4 indicating that diagonal pixels are not considered directly adjacent for polygon membership purposes or 8 indicating they are. |
useFloats
|
boolean
| undefined
|
Use floating point buffers instead of int buffers. |
progress_cb
|
ProgressCb
| undefined
|
typedef ProgressCb : Function lib/gdal.js
Parameter | Type | Description |
---|---|---|
complete |
number
|
|
msg |
string
|
typedef ProgressOptions : object lib/gdal.js
Property | Type | Description |
---|---|---|
progress_cb
|
ProgressCb
|
typedef ReprojectOptions : object src/gdal_warper.cpp
Property | Type | Description |
---|---|---|
src
|
Dataset
|
|
dst
|
Dataset
|
|
s_srs
|
SpatialReference
|
|
t_srs
|
SpatialReference
|
|
resampling
|
string
| undefined
|
|
cutline
|
Geometry
| undefined
|
|
srcBands
|
Array
<
number
>
| undefined
|
|
dstBands
|
Array
<
number
>
| undefined
|
|
srcAlphaBand
|
number
| undefined
|
|
dstAlphaBand
|
number
| undefined
|
|
srcNodata
|
number
| undefined
|
|
dstNodata
|
number
| undefined
|
|
blend
|
number
| undefined
|
|
memoryLimit
|
number
| undefined
|
|
maxError
|
number
| undefined
|
|
multi
|
boolean
| undefined
|
|
options
|
object
| undefined
|
|
progress_cb
|
ProgressCb
| undefined
|
typedef SieveOptions : object src/gdal_algorithms.cpp
Property | Type | Description |
---|---|---|
src
|
RasterBand
|
|
dst
|
RasterBand
|
|
mask
|
RasterBand
| undefined
|
|
threshold
|
number
|
|
connectedness
|
number
| undefined
|
|
progress_cb
|
ProgressCb
| undefined
|
typedef StringOptions : Array < string > | Record < string , string | number | Array < string | number > > src/node_gdal.cpp
typedef UtilOptions : object src/gdal_utils.cpp
Property | Type | Description |
---|---|---|
progress_cb
|
ProgressCb
| undefined
|
typedef VRTBandDescriptor : object lib/wrapVRT.js
Property | Type | Description |
---|---|---|
sources
|
Array
<
RasterBand
>
|
Source data raster bands |
pixelFunc
|
string
| undefined
|
Pixel function to be applied when reading data, must be a GDAL builtin function or a registered user function |
pixelFuncArgs
|
Record
<
string
, string
| number
>
| undefined
|
Additional arguments for the pixel function |
dataType
|
string
| undefined
|
Data type to convert the pixels to |
sourceTransferType
|
string
| undefined
|
Data type to be used as input of the pixel function when reading from the source |
description
|
string
| undefined
|
Optional band description |
typedef VRTDescriptor : object lib/wrapVRT.js
Property | Type | Description |
---|---|---|
bands
|
Array
<
VRTBandDescriptor
>
|
typedef WarpOptions : object src/gdal_warper.cpp
Property | Type | Description |
---|---|---|
src
|
Dataset
|
|
s_srs
|
SpatialReference
|
|
t_srs
|
SpatialReference
|
|
maxError
|
number
| undefined
|
typedef WarpOutput : object src/gdal_warper.cpp
Property | Type | Description |
---|---|---|
rasterSize
|
xyz
|
|
geoTransform
|
Array
<
number
>
|
Global Parameters
constant version : string src/node_gdal.cpp
GDAL version (not the binding version)
constant bundled : boolean src/node_gdal.cpp
GDAL library - system library (false) or bundled (true)
constant drivers : GDALDrivers src/node_gdal.cpp
The collection of all drivers registered with GDAL
lastError : object src/node_gdal.cpp
Details about the last error that occurred. The property will be null or an object containing three properties: "number", "message", and "type".
function verbose() src/node_gdal.cpp
Displays extra debugging information from GDAL.
eventLoopWarning : boolean src/node_gdal.cpp
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
Utilities
function addPixelFunc() src/gdal_algorithms.cpp
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.
Parameter | Type | Description |
---|---|---|
name |
string
|
|
pixelFn |
PixelFunction
|
function buildVRT() src/gdal_utils.cpp
Library version of gdalbuildvrt.
Parameter | Type | Description |
---|---|---|
dst_path |
string
|
null
|
destination path, null for an in-memory operation |
src_ds |
Array
<
Dataset
>
| Array
<
string
>
|
array of source datasets |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdalbuildvrt |
options |
UtilOptions
| undefined
|
additional options |
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' ] );
function buildVRTAsync() src/gdal_utils.cpp
Library version of gdalbuildvrt.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
dst_path |
string
|
null
|
destination path, null for an in-memory operation |
src_ds |
Array
<
Dataset
>
| Array
<
string
>
|
array of source datasets |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdalbuildvrt |
options |
UtilOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
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' ] );
function calcAsync() lib/calc.js
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 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
Parameter | Type | Description |
---|---|---|
inputs |
Record
<
string
, RasterBand
>
|
An object containing all the input bands |
output |
RasterBand
|
Output raster band |
options |
CalcOptions
| undefined
|
Options |
Promise
<
void
>
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 });
function checksumImage() src/gdal_algorithms.cpp
Compute checksum for image region.
Parameter | Type | Description |
---|---|---|
src |
RasterBand
|
|
x |
number
|
|
y |
number
|
|
w |
number
|
|
h |
number
|
number
function checksumImageAsync() src/gdal_algorithms.cpp
Compute checksum for image region.
Parameter | Type | Description |
---|---|---|
src |
RasterBand
|
|
x |
number
|
|
y |
number
|
|
w |
number
|
|
h |
number
|
|
callback |
callback
<
number
>
|
number
Promise
<
number
>
function contourGenerate() src/gdal_algorithms.cpp
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.
Parameter | Type | Description |
---|---|---|
options |
ContourOptions
|
function contourGenerateAsync() src/gdal_algorithms.cpp
Create vector contours from raster DEM.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
ContourOptions
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function createPixelFunc() lib/gdal.js
Create a GDAL pixel function from a JS expression for one pixel.
Higher-level API of
gdal.toPixelFunc
.
// 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));
function createPixelFuncWithArgs() lib/gdal.js
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.
// 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));
function decToDMS() src/node_gdal.cpp
Convert decimal degrees to degrees, minutes, and seconds string.
Parameter | Type | Description |
---|---|---|
angle |
number
|
|
axis |
string
|
|
precision |
number
|
string
A string nndnn'nn.nn'"L where n is a number and L is either N or E
function dem() src/gdal_utils.cpp
Library version of gdaldem.
Parameter | Type | Description |
---|---|---|
dst_path |
string
|
destination path |
src_ds |
Dataset
|
source dataset |
mode |
'hillshade'
|
'slope'
|
'aspect'
|
'color-relief'
|
'TRI'
|
'TPI'
|
'Roughness'
|
processing mode |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdaldem |
colorFile |
string
| undefined
|
optional color filename, see https://gdal.org/programs/gdaldem.html for more details |
options |
UtilOptions
| undefined
|
additional options |
const ds = gdal.open('input.tif')
const output = gdal.dem('/vsimem/output.tiff', ds, 'hillshade', [ '-z', '2' ])
function demAsync() src/gdal_utils.cpp
Library version of gdaldem.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
dst_path |
string
|
destination path |
src_ds |
Dataset
|
source dataset |
mode |
'hillshade'
|
'slope'
|
'aspect'
|
'color-relief'
|
'TRI'
|
'TPI'
|
'Roughness'
|
processing mode |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdaldem |
colorFile |
string
| undefined
|
optional color filename, see https://gdal.org/programs/gdaldem.html for more details |
options |
UtilOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
const ds = await gdal.openAsync('input.tif')
const output = await gdal.demAsync('/vsimem/output.tiff', ds, 'hillshade', [ '-z', '2' ])
function fillNodata() src/gdal_algorithms.cpp
Fill raster regions by interpolation from edges.
Parameter | Type | Description |
---|---|---|
options |
FillOptions
|
function fillNodataAsync() src/gdal_algorithms.cpp
Fill raster regions by interpolation from edges.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
FillOptions
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function fromDataType() lib/gdal.js
Returns a
TypedArray
constructor from a GDAL data type
Parameter | Type | Description |
---|---|---|
dataType |
string
|
null
|
TypeError
const array = new (gdal.fromDataType(band.dataType))(band.size.x * band.size.y)
`
function info() src/gdal_utils.cpp
Library version of gdalinfo.
Parameter | Type | Description |
---|---|---|
dataset |
Dataset
|
|
args |
Array
<
string
>
| undefined
|
array of CLI options for gdalinfo |
string
const ds = gdal.open('input.tif')
const output = gdal.info('/vsimem/temp.tif')
function infoAsync() src/gdal_utils.cpp
Library version of gdalinfo.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
dataset |
Dataset
|
|
args |
Array
<
string
>
| undefined
|
array of CLI options for gdalinfo |
callback |
callback
<
string
>
|
Promise
<
string
>
const ds = gdal.open('input.tif')
const output = gdal.info('/vsimem/temp.tif')
function polygonize() src/gdal_algorithms.cpp
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.
Parameter | Type | Description |
---|---|---|
options |
PolygonizeOptions
|
function polygonizeAsync() src/gdal_algorithms.cpp
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.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
PolygonizeOptions
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function quiet() src/node_gdal.cpp
Disables all output.
function rasterize() src/gdal_utils.cpp
Library version of gdal_rasterize.
Parameter | Type | Description |
---|---|---|
destination |
string
| Dataset
|
|
source |
Dataset
|
dataset |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdal_rasterize |
options |
UtilOptions
| undefined
|
additional options |
const ds1 = gdal.rasterize('/vsimem/target.tiff',
src_ds,
[ '-b', '1' ] );
const ds2 = gdal.rasterize(dst_ds,
src_ds,
[ '-b', '1' ] );
function rasterizeAsync() src/gdal_utils.cpp
Library version of gdal_rasterize.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
destination |
string
| Dataset
|
|
source |
Dataset
|
dataset |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdal_rasterize |
options |
UtilOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
const ds1 = await gdal.rasterizeAsync('/vsimem/target.tiff',
src_ds,
[ '-b', '1' ] );
const ds2 = await gdal.rasterizeAsync(dst_ds,
src_ds,
[ '-b', '1' ] );
function reprojectImage() src/gdal_warper.cpp
Reprojects a dataset.
Parameter | Type | Description |
---|---|---|
options |
ReprojectOptions
|
function reprojectImageAsync() src/gdal_warper.cpp
Reprojects a dataset.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
ReprojectOptions
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function setPROJSearchPaths() src/node_gdal.cpp
Set paths where proj will search it data.
Parameter | Type | Description |
---|---|---|
path |
string
|
|
function sieveFilter() src/gdal_algorithms.cpp
Removes small raster polygons.
Parameter | Type | Description |
---|---|---|
options |
SieveOptions
|
function sieveFilterAsync() src/gdal_algorithms.cpp
Removes small raster polygons.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
SieveOptions
|
|
callback |
callback
<
void
>
|
Promise
<
void
>
function suggestedWarpOutput() src/gdal_warper.cpp
Used to determine the bounds and resolution of the output virtual file which should be large enough to include all the input image.
Parameter | Type | Description |
---|---|---|
options |
WarpOptions
|
Warp options |
WarpOutput
An object containing
"rasterSize"
and
"geoTransform"
properties.
function suggestedWarpOutputAsync() src/gdal_warper.cpp
Used to determine the bounds and resolution of the output virtual file which should be large enough to include all the input image.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
options |
WarpOptions
|
Warp options |
callback |
callback
<
WarpOutput
>
|
Promise
<
WarpOutput
>
function toDataType() lib/gdal.js
Returns a GDAL data type from a
TypedArray
Parameter | Type | Description |
---|---|---|
array |
TypedArray
|
TypeError
string
const dataType = gdal.fromDataType(array)
`
function toPixelFunc() src/gdal_algorithms.cpp
Create a GDAL pixel function from a JS function.
As V8, and JS in general, can only have a single active JS context per isolate, even when using async I/O, the pixel function will be called on the main thread. This can lead to increased latency when serving network requests.
You can check the
gdal-exprtk
plugin for an alternative
which uses ExprTk expressions and does not suffer from this problem.
As GDAL does not allow unregistering a previously registered pixel functions, each call of this method will produce a permanently registered pixel function.
The function signature should match the GDAL pixel function signature.
You can check
createPixelFunc
for a higher-level method that can be used
to construct a GDAL pixel function from a JavaScript expression for a single pixel.
// This example will register a new GDAL pixel function called sum2
// that requires a VRT dataset with 2 values per pixel
const sum2 = (sources: gdal.TypedArray[], buffer: gdal.TypedArray) => {
for (let i = 0; i < buffer.length; i++) {
buffer[i] = sources[0][i] + sources[1][i]
}
};
gdal.addPixelFunc('sum2', gdal.toPixelFunc(sum2));
function translate() src/gdal_utils.cpp
Library version of gdal_translate.
Parameter | Type | Description |
---|---|---|
destination |
string
|
destination filename |
source |
Dataset
|
source dataset |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdal_translate |
options |
UtilOptions
| undefined
|
additional options |
const ds = gdal.open('input.tif')
const out = gdal.translate('/vsimem/temp.tif', ds, [ '-b', '1' ])
function translateAsync() src/gdal_utils.cpp
Library version of gdal_translate.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
destination |
string
|
destination filename |
source |
Dataset
|
source dataset |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdal_translate |
options |
UtilOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
const ds = gdal.open('input.tif')
const out = gdal.translate('/vsimem/temp.tif', ds, [ '-b', '1' ])
function vectorTranslate() src/gdal_utils.cpp
Library version of ogr2ogr.
Parameter | Type | Description |
---|---|---|
destination |
string
| Dataset
|
destination |
source |
Dataset
|
source dataset |
args |
Array
<
string
>
| undefined
|
array of CLI options for ogr2ogr |
options |
UtilOptions
| undefined
|
additional options |
const ds = gdal.open('input.geojson')
const out = gdal.vectorTranslate('/vsimem/temp.gpkg', ds, [ '-of', 'GPKG' ])
function vectorTranslateAsync() src/gdal_utils.cpp
Library version of ogr2ogr.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
destination |
string
| Dataset
|
destination |
source |
Dataset
|
source dataset |
args |
Array
<
string
>
| undefined
|
array of CLI options for ogr2ogr |
options |
UtilOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
const ds = gdal.open('input.geojson')
const out = gdal.vectorTranslate('/vsimem/temp.gpkg', ds, [ '-of', 'GPKG' ])
function warp() src/gdal_utils.cpp
Library version of gdalwarp.
Parameter | Type | Description |
---|---|---|
dst_path |
string
|
null
|
destination path, null for an in-memory operation |
dst_ds |
Dataset
|
null
|
destination dataset, null for a new dataset |
src_ds |
Array
<
Dataset
>
|
array of source datasets |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdalwarp |
options |
UtilOptions
| undefined
|
additional options |
const ds = gdal.open('input.tif')
const output = gdal.warp('/vsimem/output.tiff', null, [ ds ], [ '-t_srs', 'epsg:3587' ])
function warpAsync() src/gdal_utils.cpp
Library version of gdalwarp.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
dst_path |
string
|
null
|
destination path, null for an in-memory operation |
dst_ds |
Dataset
|
null
|
destination dataset, null for a new dataset |
src_ds |
Array
<
Dataset
>
|
array of source datasets |
args |
Array
<
string
>
| undefined
|
array of CLI options for gdalwarp |
options |
UtilOptions
| undefined
|
additional options |
callback |
callback
<
Dataset
>
|
const ds = await gdal.openAsync('input.tif')
const output = await gdal.warpAsync('/vsimem/output.tiff', null, [ ds ], [ '-t_srs', 'epsg:3587' ])
function wrapVRT() lib/wrapVRT.js
Produces a VRT Dataset from a regular Dataset.
Supports applying pixel functions.
Parameter | Type | Description |
---|---|---|
desc |
VRTDescriptor
|
Band descriptors |
string
// create a VRT dataset with a single band derived from the first
// band of the given dataset by applying the given pixel function
const ds = gdal.open(gdal.wrapVRT({
bands: [
{
sources: [ gdal.open('test/data/sample.tif').bands.get(1) ],
pixelFunc: 'inv',
pixelFuncArgs: { k: 3 },
type: gdal.GDT_Int16,
sourceTransferType: gdal.GDT_Float32
}
]
}));
// create a VRT dataset by applying a pixel function over
// all bands of the given dataset
const ds = gdal.open(gdal.wrapVRT({
bands: gdal.open('test/data/multiband.tif').bands.map((b) => ({
sources: [ b ],
pixelFunc: 'inv',
pixelFuncArgs: { k: 3 }
}))
}));
// use a pixel function to combine two bands from two files in one band
const ds = gdal.open(gdal.wrapVRT({
bands: [
{
sources: [
gdal.open(path.join('test', 'data', 'AROME_T2m_10.tiff')).bands.get(1),
gdal.open(path.join('test', 'data', 'AROME_D2m_10.tiff')).bands.get(1)
],
pixelFunc: 'espy'
}
]
}));
namespace config lib/gdal.js
function get() lib/gdal.js
Gets a GDAL configuration setting.
Parameter | Type | Description |
---|---|---|
key |
string
|
string
|
null
data_path = gdal.config.get('GDAL_DATA');
function set() lib/gdal.js
Sets a GDAL configuration setting.
Parameter | Type | Description |
---|---|---|
key |
string
|
|
value |
string
|
null
|
void
gdal.config.set('GDAL_DATA', data_path);
namespace fs src/gdal_fs.cpp
GDAL VSI layer file operations.
typedef VSIStat : object src/gdal_fs.cpp
Property | Type | Description |
---|---|---|
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
|
typedef VSIStat64 : object src/gdal_fs.cpp
Property | Type | Description |
---|---|---|
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
|
function readDir() src/gdal_fs.cpp
Read file names in a directory.
Parameter | Type | Description |
---|---|---|
directory |
string
|
Array
<
string
>
function readDirAsync() src/gdal_fs.cpp
Read file names in a directory.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
directory |
string
|
|
callback |
callback
<
Array
<
string
>
>
|
Promise
<
Array
<
string
>
>
function stat() src/gdal_fs.cpp
Get VSI file info.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
bigint |
false
|
Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53. |
const gdalStats = gdal.fs.stat('/vsis3/noaa-gfs-bdp-pds/gfs.20210918/06/atmos/gfs.t06z.pgrb2.0p25.f010')
if ((gdalStats.mode & fs.constants.S_IFREG) === fs.constants.S_IFREG) console.log('is regular file')
// convert to Node.js fs.Stats
const fsStats = new (Function.prototype.bind.apply(fs.Stats, [null, ...Object.keys(s).map(k => s[k])]))
if (fsStats.isFile) console.log('is regular file')
function stat() src/gdal_fs.cpp
Get VSI file info.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
True |
true
|
Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53. |
function statAsync() src/gdal_fs.cpp
Get VSI file info.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
bigint |
false
|
Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53. |
callback |
callback
<
VSIStat
>
|
function statAsync() src/gdal_fs.cpp
Get VSI file info.
This is an asynchronous call. If its last argument is a function, then this function will be called on completion following the standard Node.js callback convection of `(error, result)`. The return value will be `undefined. The callback can be specified even if some optional arguments are omitted. Argument errors will throw, but runtime errors will be reported via the callback. If the last argument is not a callback the function will return a Promise that will resolve with the result. In this case all errors will result in a rejected Promise.
Parameter | Type | Description |
---|---|---|
filename |
string
|
|
True |
true
|
Return BigInt numbers. JavaScript numbers are safe for integers up to 2^53. |
callback |
callback
<
VSIStat
>
|
namespace vsimem src/gdal_memfile.cpp
File operations specific to in-memory
/vsimem/
files.
function copy() src/gdal_memfile.cpp
Create an in-memory
/vsimem/
file copying a
Buffer
.
This method copies the
Buffer
into GDAL's own memory heap
creating an in-memory file that can be freely extended by GDAL.
gdal.vsimem.set
is the better choice unless the file needs to be extended.
The file will stay in memory until it is deleted with
gdal.vsimem.release
.
Parameter | Type | Description |
---|---|---|
data |
Buffer
|
A binary buffer containing the file data |
filename |
string
|
A file name beginning with
|
function release() src/gdal_memfile.cpp
Delete and retrieve the contents of an in-memory
/vsimem/
file.
This is a very fast zero-copy operation.
It does not block the event loop.
If the file was created by
vsimem.set
, it will return a reference
to the same
Buffer
that was used to create it.
Otherwise it will construct a new
Buffer
object with the GDAL
allocated buffer as its backing store.
!
The file must not be open or random memory corruption is possible with GDAL <= 3.3.1. GDAL >= 3.3.2 will gracefully fail further operations and this function will always be safe.
Parameter | Type | Description |
---|---|---|
filename |
string
|
A file name beginning with
|
Buffer
A binary buffer containing all the data
function set() src/gdal_memfile.cpp
Create an in-memory
/vsimem/
file from a
Buffer
.
This is a zero-copy operation - GDAL will read from the Buffer which will be
protected by the GC even if it goes out of scope.
The file will stay in memory until it is deleted with
gdal.vsimem.release
.
The file will be in read-write mode, but GDAL won't
be able to extend it as the allocated memory will be tied to the
Buffer
object.
Use
gdal.vsimem.copy
to create an extendable copy.
Parameter | Type | Description |
---|---|---|
data |
Buffer
|
A binary buffer containing the file data |
filename |
string
|
A file name beginning with
|