gdal.LayerFields
Table of Contents
Methods
add
-
def(s)
-
approx=true
Adds field(s).
Parameters:
-
def(s)
gdal.FieldDefn | ArrayA field definition, or array of field definitions.
-
[approx=true]
Boolean optional
count
()
Integer
Returns the number of fields.
Returns:
forEach
-
callback
Iterates through all field definitions using a callback function.
Parameters:
-
callback
FunctionThe callback to be called with each FieldDefn
Example:
layer.fields.forEach(function(field, i) { ... });`
fromJSON
-
object
-
approx_ok=false
Creates a LayerFields instance from an object of keys and values.
Parameters:
-
object
Object -
[approx_ok=false]
Boolean optional
Returns a field definition.
Parameters:
-
field
String | IntegerField name or index (0-based)
Returns:
getNames
()
Array
Returns a list of field names.
Returns:
List of strings.
indexOf
-
field
Find the index of field in the layer.
Parameters:
-
field
String
Returns:
Field index, or -1 if the field doesn't exist
map
-
callback
Iterates through all field definitions using a callback function and builds an array of the returned values.
Parameters:
-
callback
FunctionThe 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 | IntegerField name or index (0-based)
reorder
-
map
Reorders fields.
Parameters:
-
map
ArrayAn array of new indexes (integers)
Example:
// reverse field order
layer.fields.reorder([2,1,0]);`