Show:

An encapsulation of a Layer's features.

Methods

add
(
  • feature
)

Adds a feature to the layer. The feature should be created using the current layer as the definition.

Parameters:

Example:

var feature = new gdal.Feature(layer);
feature.setGeometry(new gdal.Point(0, 1));
feature.fields.set('name', 'somestring');
layer.features.add(feature);`
count
(
  • force=true
)
Integer

Returns the number of features in the layer.

Parameters:

  • [force=true] Boolean optional

Returns:

Integer:

Number of features in the layer.

first () gdal.Feature

Resets the feature pointer used by next() and returns the first feature in the layer.

Returns:

forEach
(
  • callback
)

Defined in lib/gdal.js:156

Iterates through all features using a callback function.

Parameters:

  • callback Function

    The callback to be called with each Feature

Example:

layer.features.forEach(function(feature, i) { ... });`
get
(
  • id
)
gdal.Feature

Fetch a feature by its identifier.

Important: 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.

Parameters:

  • id Integer

    The feature ID of the feature to read.

Returns:

map
(
  • callback
)

Defined in lib/gdal.js:176

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

Parameters:

  • callback Function

    The callback to be called with each Feature

Example:

var result = layer.features.map(function(band, i) {
    return value;
});`
next () gdal.Feature

Returns the next feature in the layer. Returns null if no more features.

Returns:

Example:

while (feature = layer.features.next()) { ... }`
remove
(
  • id
)

Removes a feature from the layer.

Parameters:

  • id Integer
set
(
  • id
  • feature
)

Sets a feature in the layer.

Parameters:

Attributes

layer

gdal.Layer

Parent layer