gdal.Layer
A representation of a layer of simple vector features, with access methods.
Table of Contents
Methods
flush
()
Flush pending changes to disk.
Fetch the extent of this layer.
Parameters:
-
[force=true]
Boolean optional
Returns:
Bounding envelope
This method returns the current spatial filter for this layer.
Returns:
setAttributeFilter
-
filter
Sets the attribute query string to be used when fetching features via the
layer.features.next()
method. Only features for which the query evaluates
as true
will be returned.
The query string should be in the format of an SQL WHERE clause. For instance
"population > 1000000 and population < 5000000" where population
is an
attribute in the layer. The query format is normally a restricted form of
SQL WHERE clause as described in the "WHERE" section of the OGR SQL
tutorial. In some cases (RDBMS backed
drivers) the native capabilities of the database may be used to interprete
the WHERE clause in which case the capabilities will be broader than those
of OGR SQL.
Parameters:
-
filter
String
Example:
layer.setAttributeFilter('population > 1000000 and population < 5000000');`
setSpatialFilter
-
filter
This method sets the geometry to be used as a spatial filter when fetching
features via the layer.features.next()
method. Only features that
geometrically intersect the filter geometry will be returned.
Alernatively you can pass it envelope bounds as individual arguments.
Parameters:
-
filter
gdal.Geometry
Example:
layer.setSpatialFilter(geometry);
layer.setSpatialFilter(minX, minY, maxX, maxY);`
testCapability
-
capability
Determines if the dataset supports the indicated operation.
Parameters:
-
capability
String(see capability list)