Show:

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

Methods

flush ()

Flush pending changes to disk.

flushAsync
(
  • callback=undefined
)
Promise

Flush pending changes to disk. Asynchronous version. If the last parameter is a callback, then this callback is called on completion and undefined is returned. All optional parameters before the callback can be omitted so the callback parameter can be at any position as long as it is the last parameter. Otherwise the function returns a Promise resolved with the result.

Parameters:

  • [callback=undefined] Callback optional

    standard Node.js (error, result) callback. It is always the last parameter and can be specified even if certain optional parameters are omitted. On error error is an Error object and result is undefined. On success error is null and result contains the result. The function returns a Promise when the callback is undefined. The return value is undefined when a callback is provided. Argument type errors are thrown synchronously even when a callback is provided. In Promise mode all errors result in a rejected Promise.

Returns:

Promise
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=null
)

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=null] String | Null optional

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);`
setSpatialFilter
(
  • minxX
  • minyY
  • maxX
  • maxY
)

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:

  • minxX Number
  • minyY Number
  • maxX Number
  • maxY Number

Example:

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

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

name

String readonly