Show:

Methods

add
(
  • defs
  • approx=true
)

Adds field(s).

Parameters:

count () Number

Returns the number of fields.

Returns:

Number
forEach
(
  • callback
)

Iterates through all field definitions using a callback function.

Parameters:

  • callback forEachCb

    The callback to be called with each FieldDefn

Example:

layer.fields.forEach(function(array, i) { ... });`
fromJSON
(
  • object
  • approx_ok=false
)

Defined in lib/gdal.js:498

Creates a LayerFields instance from an object of keys and values.

Parameters:

  • object Object
  • [approx_ok=false] Boolean optional
fromObject
(
  • object
  • approx_ok=false
)

Defined in lib/gdal.js:519

Creates a LayerFields instance from an object of keys and values.

Parameters:

  • object Record
  • [approx_ok=false] Boolean optional
get
(
  • field
)
gdal.FieldDefn

Returns a field definition.

Parameters:

  • field String | Number

    Field name or index (0-based)

Returns:

getNames () String[]

Returns a list of field names.

Returns:

String[]:

List of strings.

indexOf
(
  • field
)
Number

Find the index of field in the layer.

Parameters:

  • field String

Returns:

Number:

Field index, or -1 if the field doesn't exist

map<U>
(
  • callback
)
U[]

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

Parameters:

  • callback mapCb

    The callback to be called with each FieldDefn

Returns:

U[]

Example:

var result = layer.fields.map(function(array, i) {
    return value;
});`
remove
(
  • field
)

Removes a field.

Parameters:

  • field String | Number

    Field name or index (0-based)

reorder
(
  • map
)

Reorders fields.

Parameters:

  • map Number[]

    An array of new indexes (integers)

Example:

// reverse field order
layer.fields.reorder([2,1,0]);`
Symbol.asyncIterator ()

Iterates through all field definitions using an async iterator

Example:

for await (const array of layer.fields) {
}
Symbol.iterator ()

Iterates through all field definitions using an iterator

Example:

for (const array of layer.fields) {
}

Attributes

layer

gdal.Layer readonly

Parent layer