Class: QgsVectorLayerTemporalProperties

class qgis.core.QgsVectorLayerTemporalProperties

Bases: QgsMapLayerTemporalProperties

Implementation of map layer temporal properties for vector layers.

New in version 3.14.

QgsVectorLayerTemporalProperties(parent: QObject = None, enabled: bool = False) Constructor for QgsVectorLayerTemporalProperties, with the specified parent object.

The enabled argument specifies whether the temporal properties are initially enabled or not (see isActive()).

Enums

TemporalMode

alias of VectorTemporalMode

Methods

accumulateFeatures

Returns True if features will be accumulated over time (i.e. all features which occur before or within the map's temporal range should be rendered).

childEvent

connectNotify

createFilterString

Creates a QGIS expression filter string for filtering features within the specified context to those within the specified time range.

customEvent

disconnectNotify

durationField

Returns the name of the duration field, which contains the duration of the event.

durationUnits

Returns the units of the event's duration.

endExpression

Returns the expression for the end time for the feature's time spans.

endField

Returns the name of the end datetime field, which contains the end time for the feature's time spans.

fixedDuration

Returns the fixed duration length, which contains the duration of the event.

fixedTemporalRange

Returns the fixed temporal range for the layer.

flags

Returns flags associated to the temporal property.

guessDefaultsFromFields

Attempts to setup the temporal properties by scanning a set of fields and looking for standard naming conventions (e.g. "begin_date").

isSignalConnected

isVisibleInTemporalRange

param range:

limitMode

Returns the temporal limit mode (to include or exclude begin/end limits).

mode

Returns the temporal properties mode.

readXml

param element:

receivers

sender

senderSignalIndex

setAccumulateFeatures

Sets whether features will be accumulated over time (i.e. all features which occur before or within the map's temporal range should be rendered).

setDefaultsFromDataProviderTemporalCapabilities

param capabilities:

setDurationField

Sets the name of the duration field, which contains the duration of the event.

setDurationUnits

Sets the units of the event's duration.

setEndExpression

Sets the expression to use for the end time for the feature's time spans.

setEndField

Sets the name of the end datetime field, which contains the end time for the feature's time spans.

setFixedDuration

Sets the fixed event duration, which contains the duration of the event.

setFixedTemporalRange

Sets a temporal range to apply to the whole layer.

setLimitMode

Sets the temporal limit mode (to include or exclude begin/end limits).

setMode

Sets the temporal properties mode.

setStartExpression

Sets the expression to use for the start time for the feature's time spans.

setStartField

Sets the name of the start datetime field, which contains the start time for the feature's time spans.

startExpression

Returns the expression for the start time for the feature's time spans.

startField

Returns the name of the start datetime field, which contains the start time for the feature's time spans.

timerEvent

writeXml

param element:

TemporalMode

alias of VectorTemporalMode

accumulateFeatures(self) bool

Returns True if features will be accumulated over time (i.e. all features which occur before or within the map’s temporal range should be rendered).

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField

Return type:

bool

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createFilterString(self, context: QgsVectorLayerTemporalContext, range: QgsDateTimeRange) str

Creates a QGIS expression filter string for filtering features within the specified context to those within the specified time range.

The returned expression string considers the mode() and other related settings (such as startField()) when building the filter string.

Warning

Note that ModeFixedTemporalRange is intentional NOT handled by this method and if mode() is ModeFixedTemporalRange then an empty string will be returned. Use isVisibleInTemporalRange() when testing whether features from a layer set to the ModeFixedTemporalRange should ALL be filtered out.

Parameters:
Return type:

str

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
durationField(self) str

Returns the name of the duration field, which contains the duration of the event.

Units are specified by durationUnits()

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndDurationFromFields

See also

durationUnits()

Return type:

str

durationUnits(self) Qgis.TemporalUnit

Returns the units of the event’s duration.

Return type:

Qgis.TemporalUnit

endExpression(self) str

Returns the expression for the end time for the feature’s time spans.

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions

Return type:

str

endField(self) str

Returns the name of the end datetime field, which contains the end time for the feature’s time spans.

See also

setEndField()

See also

startField()

Return type:

str

fixedDuration(self) float

Returns the fixed duration length, which contains the duration of the event.

Units are specified by durationUnits()

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField

See also

durationUnits()

Return type:

float

fixedTemporalRange(self) QgsDateTimeRange

Returns the fixed temporal range for the layer.

Warning

To be used only when mode() is QgsVectorLayerTemporalProperties.ModeFixedTemporalRange

Return type:

QgsDateTimeRange

flags(self) QgsTemporalProperty.Flags

Returns flags associated to the temporal property.

Return type:

QgsTemporalProperty.Flags

guessDefaultsFromFields(self, fields: QgsFields)

Attempts to setup the temporal properties by scanning a set of fields and looking for standard naming conventions (e.g. “begin_date”).

Parameters:

fields (QgsFields) –

isSignalConnected(self, QMetaMethod) bool
isVisibleInTemporalRange(self, range: QgsDateTimeRange) bool
Parameters:

range (QgsDateTimeRange) –

Return type:

bool

limitMode(self) Qgis.VectorTemporalLimitMode

Returns the temporal limit mode (to include or exclude begin/end limits).

See also

setLimitMode()

New in version 3.22.

Return type:

Qgis.VectorTemporalLimitMode

mode(self) Qgis.VectorTemporalMode

Returns the temporal properties mode.

See also

setMode()

Return type:

Qgis.VectorTemporalMode

readXml(self, element: QDomElement, context: QgsReadWriteContext) bool
Parameters:
Return type:

bool

receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
setAccumulateFeatures(self, accumulate: bool)

Sets whether features will be accumulated over time (i.e. all features which occur before or within the map’s temporal range should be rendered).

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField

Parameters:

accumulate (bool) –

setDefaultsFromDataProviderTemporalCapabilities(self, capabilities: QgsDataProviderTemporalCapabilities)
Parameters:

capabilities (QgsDataProviderTemporalCapabilities) –

setDurationField(self, field: str)

Sets the name of the duration field, which contains the duration of the event.

Units are specified by setDurationUnits()

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndDurationFromFields

See also

durationField()

Parameters:

field (str) –

setDurationUnits(self, units: Qgis.TemporalUnit)

Sets the units of the event’s duration.

See also

durationUnits()

Parameters:

units (Qgis.TemporalUnit) –

setEndExpression(self, endExpression: str)

Sets the expression to use for the end time for the feature’s time spans.

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions

See also

endExpression()

Parameters:

endExpression (str) –

setEndField(self, field: str)

Sets the name of the end datetime field, which contains the end time for the feature’s time spans.

See also

endField()

See also

setStartField()

Parameters:

field (str) –

setFixedDuration(self, duration: float)

Sets the fixed event duration, which contains the duration of the event.

Units are specified by setDurationUnits()

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField

See also

fixedDuration()

Parameters:

duration (float) –

setFixedTemporalRange(self, range: QgsDateTimeRange)

Sets a temporal range to apply to the whole layer. All features from the layer will be rendered whenever the current datetime range of a render context intersects the specified range.

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFixedTemporalRange

Parameters:

range (QgsDateTimeRange) –

setLimitMode(self, mode: Qgis.VectorTemporalLimitMode)

Sets the temporal limit mode (to include or exclude begin/end limits).

See also

limitMode()

New in version 3.22.

Parameters:

mode (Qgis.VectorTemporalLimitMode) –

setMode(self, mode: Qgis.VectorTemporalMode)

Sets the temporal properties mode.

See also

mode()

Parameters:

mode (Qgis.VectorTemporalMode) –

setStartExpression(self, expression: str)

Sets the expression to use for the start time for the feature’s time spans.

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions

Parameters:

expression (str) –

setStartField(self, field: str)

Sets the name of the start datetime field, which contains the start time for the feature’s time spans.

If mode() is ModeFeatureDateTimeInstantFromField, then this field represents both the start AND end times.

See also

startField()

See also

setEndField()

Parameters:

field (str) –

startExpression(self) str

Returns the expression for the start time for the feature’s time spans.

Warning

This setting is only effective when mode() is QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions

See also

endExpression()

Return type:

str

startField(self) str

Returns the name of the start datetime field, which contains the start time for the feature’s time spans.

If mode() is ModeFeatureDateTimeInstantFromField, then this field represents both the start AND end times.

See also

setStartField()

See also

endField()

Return type:

str

timerEvent(self, QTimerEvent)
writeXml(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) QDomElement
Parameters:
Return type:

QDomElement