Show:

Methods

add
(
  • def(s)
  • approx=true
)

Adds field(s).

Parameters:

  • def(s) gdal.FieldDefn | Array

    A field definition, or array of field definitions.

  • [approx=true] Boolean optional
count () Integer

Returns the number of fields.

Returns:

Integer
forEach
(
  • callback
)

Defined in lib/gdal.js:238

Iterates through all field definitions using a callback function.

Parameters:

  • callback Function

    The callback to be called with each FieldDefn

Example:

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

Defined in lib/gdal.js:601

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

Parameters:

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

Returns a field definition.

Parameters:

  • field String | Integer

    Field name or index (0-based)

Returns:

getNames () Array

Returns a list of field names.

Returns:

Array:

List of strings.

indexOf
(
  • field
)
Integer

Find the index of field in the layer.

Parameters:

  • field String

Returns:

Integer:

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

map
(
  • callback
)

Defined in lib/gdal.js:251

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

Parameters:

  • callback Function

    The callback to be called with each FieldDefn

Example:

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

Removes a field.

Parameters:

  • field String | Integer

    Field name or index (0-based)

reorder
(
  • map
)

Reorders fields.

Parameters:

  • map Array

    An array of new indexes (integers)

Example:

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

Attributes

layer

gdal.Layer readonly

Parent layer