Class: QgsVectorLayerTemporalProperties

class qgis.core.QgsVectorLayerTemporalProperties(parent: QObject = None, enabled: bool = False)

Bases: QgsMapLayerTemporalProperties

Constructor for QgsVectorLayerTemporalProperties, with the specified parent object.

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

Implementation of map layer temporal properties for vector layers.

New in version 3.14.

Parameters
  • parent (QObject = None) –

  • enabled

ModeFeatureDateTimeInstantFromField = 1
ModeFeatureDateTimeStartAndDurationFromFields = 3
ModeFeatureDateTimeStartAndEndFromExpressions = 4
ModeFeatureDateTimeStartAndEndFromFields = 2
ModeFixedTemporalRange = 0
ModeRedrawLayerOnly = 5
class TemporalMode

Bases: int

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)QgsUnitTypes.TemporalUnit

Returns the units of the event’s duration.

Return type

QgsUnitTypes.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

mode(self)QgsVectorLayerTemporalProperties.TemporalMode

Returns the temporal properties mode.

See also

setMode()

Return type

QgsVectorLayerTemporalProperties.TemporalMode

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: QgsUnitTypes.TemporalUnit)

Sets the units of the event’s duration.

See also

durationUnits()

Parameters

units (QgsUnitTypes.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) –

setMode(self, mode: QgsVectorLayerTemporalProperties.TemporalMode)

Sets the temporal properties mode.

See also

mode()

Parameters

mode (QgsVectorLayerTemporalProperties.TemporalMode) –

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