Show:

A representation of a layer of simple vector features, with access methods.

Methods

flush ()

Flush pending changes to disk.

getExtent
(
  • force=true
)
gdal.Envelope

Fetch the extent of this layer.

Parameters:

  • [force=true] Boolean optional

Returns:

gdal.Envelope:

Bounding envelope

getSpatialFilter () gdal.Geometry

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:

Example:

layer.setSpatialFilter(geometry);
layer.setSpatialFilter(minX, minY, maxX, maxY);`
testCapability
(
  • capability
)
Boolean

Determines if the dataset supports the indicated operation.

Parameters:

Returns:

Boolean

Attributes

ds

gdal.Dataset readonly

features

gdal.LayerFeatures readonly

fidColumn

String readonly

fields

gdal.LayerFields readonly

geomColumn

String readonly

geomType

Integer (see #crossLink "Constants (wkb)"geometry types/crossLink) readonly

name

String readonly