gdal.LayerFeatures
An encapsulation of a Layer's features.
Table of Contents
- Methods
- Attributes
Methods
add
-
feature
Adds a feature to the layer. The feature should be created using the current layer as the definition.
Parameters:
-
feature
gdal.Feature
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
Returns the number of features in the layer.
Parameters:
-
[force=true]
Boolean optional
Returns:
Number of features in the layer.
Resets the feature pointer used by next()
and
returns the first feature in the layer.
Returns:
forEach
-
callback
Iterates through all features using a callback function.
Parameters:
-
callback
FunctionThe callback to be called with each Feature
Example:
layer.features.forEach(function(feature, i) { ... });`
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
IntegerThe feature ID of the feature to read.
Returns:
map
-
callback
Iterates through all features using a callback function and builds an array of the returned values.
Parameters:
-
callback
FunctionThe callback to be called with each Feature
Example:
var result = layer.features.map(function(band, i) {
return value;
});`
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:
-
[id]
Integer optional -
feature
gdal.Feature