Class: QgsSensorThingsExpansionDefinition

Encapsulates information about how relationships in a SensorThings API service should be expanded.

Added in version 3.38.

class qgis.core.QgsSensorThingsExpansionDefinition[source]

Bases: object

__init__(childEntity: Qgis.SensorThingsEntity = Qgis.SensorThingsEntity.Invalid, orderBy: str | None = '', sortOrder: Qt.SortOrder = Qt.SortOrder.AscendingOrder, limit: int = QgsSensorThingsUtils.DEFAULT_EXPANSION_LIMIT, filter: str | None = '')

Constructor for QgsSensorThingsExpansionDefinition, targeting the specified child entity type.

Parameters:
  • childEntity (Qgis.SensorThingsEntity = Qgis.SensorThingsEntity.Invalid)

  • orderBy (Optional[str] = '')

  • sortOrder (Qt.SortOrder = Qt.SortOrder.AscendingOrder)

  • limit (int = QgsSensorThingsUtils.DEFAULT_EXPANSION_LIMIT)

  • filter (Optional[str] = '')

__init__(a0: QgsSensorThingsExpansionDefinition)
Parameters:

a0 (QgsSensorThingsExpansionDefinition)

asQueryString(self, parentEntityType: Qgis.SensorThingsEntity, additionalOptions: Iterable[str | None] = []) str[source]

Returns the expansion as a valid SensorThings API query string, eg “$expand=Observations($orderby=phenomenonTime desc;$top=10)”.

The parent entity type for the expansion must be specified.

Optionally a list of additional query options can be specified for the expansion.

Parameters:
Return type:

str

childEntity(self) Qgis.SensorThingsEntity[source]

Returns the target child entity which should be expanded.

See also

setChildEntity()

Return type:

Qgis.SensorThingsEntity

static defaultDefinitionForEntity(entity: Qgis.SensorThingsEntity) QgsSensorThingsExpansionDefinition[source]

Returns an expansion definition for the specified entity type, populated with reasonable defaults which make sense for that entity type.

Parameters:

entity (Qgis.SensorThingsEntity)

Return type:

QgsSensorThingsExpansionDefinition

filter(self) str[source]

Returns the the string filter to filter expanded child entities by.

See also

setFilter()

Return type:

str

static fromString(string: str | None) QgsSensorThingsExpansionDefinition[source]

Returns a QgsSensorThingsExpansionDefinition from a string representation.

See also

toString()

Parameters:

string (Optional[str])

Return type:

QgsSensorThingsExpansionDefinition

isValid(self) bool[source]

Returns True if the definition is valid.

Return type:

bool

limit(self) int[source]

Returns the limit on the number of child features to fetch.

Returns -1 if no limit is defined.

See also

setLimit()

Return type:

int

orderBy(self) str[source]

Returns the field name to order the expanded child entities by.

See also

sortOrder()

See also

setOrderBy()

Return type:

str

setChildEntity(self, entity: Qgis.SensorThingsEntity)[source]

Sets the target child entity which should be expanded.

See also

childEntity()

Parameters:

entity (Qgis.SensorThingsEntity)

setFilter(self, filter: str | None)[source]

Returns the the string filter to filter expanded child entities by.

See also

filter()

Parameters:

filter (Optional[str])

setLimit(self, limit: int)[source]

Sets the limit on the number of child features to fetch.

Set to -1 if no limit is desired.

See also

limit()

Parameters:

limit (int)

setOrderBy(self, field: str | None)[source]

Sets the field name to order the expanded child entities by.

See also

orderBy()

See also

setSortOrder()

Parameters:

field (Optional[str])

setSortOrder(self, order: Qt.SortOrder)[source]

Sets the sort order for the expanded child entities.

See also

setOrderBy()

See also

sortOrder()

Parameters:

order (Qt.SortOrder)

sortOrder(self) Qt.SortOrder[source]

Returns the sort order for the expanded child entities.

See also

orderBy()

See also

setSortOrder()

Return type:

Qt.SortOrder

toString(self) str[source]

Returns a string encapsulation of the expansion definition.

See also

fromString()

Return type:

str