Show:

An encapsulation of a Dataset's vector layers.

var layers = dataset.layers;`

Methods

copy
(
  • src_lyr_name
  • dst_lyr_name
  • options=null
)
gdal.Layer

Copies a layer.

Parameters:

  • src_lyr_name gdal.Layer
  • dst_lyr_name String
  • [options=null] Object | String[] optional

    layer creation options

Returns:

copyAsync
(
  • src_lyr_name
  • dst_lyr_name
  • options=null
  • callback=undefined
)
Promise

Copies a layer. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • src_lyr_name gdal.Layer
  • dst_lyr_name String
  • [options=null] Object | String[] optional

    layer creation options

  • [callback=undefined] callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
count () Number

Returns the number of layers.

Returns:

Number
countAsync
(
  • callback=undefined
)
Promise

Returns the number of layers. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
create
(
  • name
  • srs=null
  • geomType=null
  • creation_options
)
gdal.Layer

Adds a new layer.

Parameters:

  • name String

    Layer name

  • [srs=null] gdal.SpatialReference | Null optional

    Layer projection

  • [geomType=null] Number | Function | Null optional

    Geometry type or constructor (see geometry types)

  • [creation_options] String[] | Object optional

    driver-specific layer creation options

Returns:

Example:

dataset.layers.create('layername', null, gdal.Point);
createAsync
(
  • name
  • srs=null
  • geomType=null
  • creation_options
  • callback=undefined
)
Promise

Adds a new layer. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • name String

    Layer name

  • [srs=null] gdal.SpatialReference | Null optional

    Layer projection

  • [geomType=null] Number | Function | Null optional

    Geometry type or constructor (see geometry types)

  • [creation_options] String[] | Object optional

    driver-specific layer creation options

  • [callback=undefined] callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise

Example:

await dataset.layers.createAsync('layername', null, gdal.Point);
dataset.layers.createAsync('layername', null, gdal.Point, (e, r) => console.log(e, r));
forEach
(
  • callback
)

Iterates through all layers using a callback function.

Parameters:

  • callback forEachCb

    The callback to be called with each Layer

Example:

dataset.layers.forEach(function(array, i) { ... });`
get
(
  • key
)
gdal.Layer

Returns the layer with the given name or identifier.

Parameters:

  • key String | Number

    Layer name or ID.

Returns:

getAsync
(
  • key
  • callback=undefined
)
Promise

Returns the layer with the given name or identifier. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • key String | Number

    Layer name or ID.

  • [callback=undefined] callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
map<U>
(
  • callback
)
U[]

Iterates through layers using a callback function and builds an array of the returned values.

Parameters:

  • callback mapCb

    The callback to be called with each Layer

Returns:

U[]

Example:

var result = dataset.layers.map(function(array, i) {
    return value;
});`
remove
(
  • index
)

Removes a layer.

Parameters:

  • index Number
removeAsync
(
  • index
  • callback=undefined
)
Promise

Removes a layer. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • index Number
  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
Symbol.asyncIterator ()

Iterates through all layers using an async iterator

Example:

for await (const array of dataset.layers) {
}
Symbol.iterator ()

Iterates through all layers using an iterator

Example:

for (const array of dataset.layers) {
}

Attributes

ds

gdal.Dataset readonly

Parent dataset