Class: QgsSensorThingsUtils

class qgis.core.QgsSensorThingsUtils

Bases: sip.wrapper

Utility functions for working with OGC SensorThings API services.

Added in version 3.36:

Methods

asQueryString

Returns a list of expansions as a valid SensorThings API query string, eg "$expand=Locations($orderby=id desc;$top=3;$expand=Datastreams($top=101))".

availableGeometryTypes

Returns a list of available geometry types for the server at the specified uri and entity type.

combineFilters

Combines a set of SensorThings API filter operators.

displayString

Converts a Qgis.SensorThingsEntity type to a user-friendly translated string.

entitySetStringToEntity

Converts a string value corresponding to a SensorThings entity set to a Qgis.SensorThingsEntity type.

entityToSetString

Converts a SensorThings entity set to a SensorThings entity set string.

entityTypeHasGeometry

Returns True if the specified entity type can have geometry attached.

expandableTargets

Returns a list of permissible expand targets for a given base entity type.

fieldsForEntityType

Returns the fields which correspond to a specified entity type.

fieldsForExpandedEntityType

Returns the fields which correspond to a specified entity baseType, expanded using the specified list of expandedTypes.

filterForExtent

Returns a filter string which restricts results to those within the specified extent.

filterForWkbType

Returns a filter string which restricts results to those matching the specified entityType and wkbType.

geometryFieldForEntityType

Returns the geometry field for a specified entity type.

geometryTypeForEntity

Returns the geometry type for if the specified entity type.

propertiesForEntityType

Returns the SensorThings properties which correspond to a specified entity type.

relationshipCardinality

Returns the cardinality of the relationship between a base entity type and a related entity type.

stringToEntity

Converts a string value to a Qgis.SensorThingsEntity type.

asQueryString(baseType: Qgis.SensorThingsEntity, expansions: Iterable[QgsSensorThingsExpansionDefinition]) str

Returns a list of expansions as a valid SensorThings API query string, eg “$expand=Locations($orderby=id desc;$top=3;$expand=Datastreams($top=101))”.

The base entity type for the query must be specified.

Added in version 3.38.

Parameters:
Return type:

str

availableGeometryTypes(uri: str | None, type: Qgis.SensorThingsEntity, feedback: QgsFeedback | None = None, authCfg: str | None = '') List[Qgis.GeometryType]

Returns a list of available geometry types for the server at the specified uri and entity type.

This method will block while network requests are made to the server.

Parameters:
Return type:

List[Qgis.GeometryType]

combineFilters(filters: Iterable[str | None]) str

Combines a set of SensorThings API filter operators.

See https://docs.ogc.org/is/18-088/18-088.html#requirement-request-data-filter

Added in version 3.38.

Parameters:

filters (Iterable[Optional[str]])

Return type:

str

displayString(type: Qgis.SensorThingsEntity, plural: bool = False) str

Converts a Qgis.SensorThingsEntity type to a user-friendly translated string.

If plural is True then a plural string is returned (ie “Things” instead of “Thing”).

Parameters:
Return type:

str

entitySetStringToEntity(type: str | None) Qgis.SensorThingsEntity

Converts a string value corresponding to a SensorThings entity set to a Qgis.SensorThingsEntity type.

Returns Qgis.SensorThingsEntity.Invalid if the string could not be converted to a known entity set type.

Parameters:

type (Optional[str])

Return type:

Qgis.SensorThingsEntity

entityToSetString(type: Qgis.SensorThingsEntity) str

Converts a SensorThings entity set to a SensorThings entity set string.

Added in version 3.38.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

str

entityTypeHasGeometry(type: Qgis.SensorThingsEntity) bool

Returns True if the specified entity type can have geometry attached.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

bool

expandableTargets(type: Qgis.SensorThingsEntity) List[Qgis.SensorThingsEntity]

Returns a list of permissible expand targets for a given base entity type.

Added in version 3.38.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

List[Qgis.SensorThingsEntity]

fieldsForEntityType(type: Qgis.SensorThingsEntity) QgsFields

Returns the fields which correspond to a specified entity type.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

QgsFields

fieldsForExpandedEntityType(baseType: Qgis.SensorThingsEntity, expandedTypes: Iterable[Qgis.SensorThingsEntity]) QgsFields

Returns the fields which correspond to a specified entity baseType, expanded using the specified list of expandedTypes.

Added in version 3.38.

Parameters:
Return type:

QgsFields

filterForExtent(geometryField: str | None, extent: QgsRectangle) str

Returns a filter string which restricts results to those within the specified extent.

The extent should always be specified in EPSG:4326.

Added in version 3.38.

Parameters:
Return type:

str

filterForWkbType(entityType: Qgis.SensorThingsEntity, wkbType: Qgis.WkbType) str

Returns a filter string which restricts results to those matching the specified entityType and wkbType.

Parameters:
Return type:

str

geometryFieldForEntityType(type: Qgis.SensorThingsEntity) str

Returns the geometry field for a specified entity type.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

str

geometryTypeForEntity(type: Qgis.SensorThingsEntity) Qgis.GeometryType

Returns the geometry type for if the specified entity type.

If there are no restrictions on the geometry type an ntity can have Qgis.GeometryType.Unknown will be returned.

Added in version 3.38.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

Qgis.GeometryType

propertiesForEntityType(type: Qgis.SensorThingsEntity) List[str]

Returns the SensorThings properties which correspond to a specified entity type.

Added in version 3.38.

Parameters:

type (Qgis.SensorThingsEntity)

Return type:

List[str]

relationshipCardinality(baseType: Qgis.SensorThingsEntity, relatedType: Qgis.SensorThingsEntity)

Returns the cardinality of the relationship between a base entity type and a related entity type.

Parameters:
Returns:

  • relationship cardinality

  • valid: will be set to True if a relationship exists between the entity types, or False if no relationship exists

Added in version 3.38.

stringToEntity(type: str | None) Qgis.SensorThingsEntity

Converts a string value to a Qgis.SensorThingsEntity type.

Returns Qgis.SensorThingsEntity.Invalid if the string could not be converted to a known entity type.

Parameters:

type (Optional[str])

Return type:

Qgis.SensorThingsEntity