Class: QgsSensorThingsUtils¶
Utility functions for working with OGC SensorThings API services.
Added in version 3.36.
Static Methods
Returns a list of expansions as a valid SensorThings API query string, eg "$expand=Locations($orderby=id desc;$top=3;$expand=Datastreams($top=101))".  | 
|
Returns a list of available geometry types for the server at the specified uri and entity type.  | 
|
Combines a set of SensorThings API filter operators.  | 
|
Converts a   | 
|
Converts a string value corresponding to a SensorThings entity set to a   | 
|
Converts a SensorThings entity set to a SensorThings entity set string.  | 
|
Returns   | 
|
Returns a list of permissible expand targets for a given base entity type.  | 
|
Returns the fields which correspond to a specified entity type.  | 
|
Returns the fields which correspond to a specified entity baseType, expanded using the specified list of expandedTypes.  | 
|
Returns a filter string which restricts results to those within the specified extent.  | 
|
Returns a filter string which restricts results to those matching the specified entityType and wkbType.  | 
|
Returns the geometry field for a specified entity type.  | 
|
Returns the geometry type for if the specified entity type.  | 
|
Returns the SensorThings properties which correspond to a specified entity type.  | 
|
Returns the cardinality of the relationship between a base entity type and a related entity type.  | 
|
Converts a string value to a   | 
- class qgis.core.QgsSensorThingsUtils[source]¶
 Bases:
object- static asQueryString(baseType: Qgis.SensorThingsEntity, expansions: Iterable[QgsSensorThingsExpansionDefinition]) str[source]¶
 Returns a list of
expansionsas 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:
 baseType (Qgis.SensorThingsEntity)
expansions (Iterable[QgsSensorThingsExpansionDefinition])
- Return type:
 str
- static 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
uriand entitytype.This method will block while network requests are made to the server.
- Parameters:
 uri (Optional[str])
type (Qgis.SensorThingsEntity)
feedback (Optional[QgsFeedback] = None)
authCfg (Optional[str] = '')
- Return type:
 List[Qgis.GeometryType]
- static combineFilters(filters: Iterable[str | None]) str[source]¶
 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
- static displayString(type: Qgis.SensorThingsEntity, plural: bool = False) str[source]¶
 Converts a
Qgis.SensorThingsEntitytypeto a user-friendly translated string.If
pluralisTruethen a plural string is returned (ie “Things” instead of “Thing”).- Parameters:
 type (Qgis.SensorThingsEntity)
plural (bool = False)
- Return type:
 str
- static entitySetStringToEntity(type: str | None) Qgis.SensorThingsEntity[source]¶
 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:
 
- static entityToSetString(type: Qgis.SensorThingsEntity) str[source]¶
 Converts a SensorThings entity set to a SensorThings entity set string.
Added in version 3.38.
- Parameters:
 type (Qgis.SensorThingsEntity)
- Return type:
 str
- static entityTypeHasGeometry(type: Qgis.SensorThingsEntity) bool[source]¶
 Returns
Trueif the specified entitytypecan have geometry attached.- Parameters:
 type (Qgis.SensorThingsEntity)
- Return type:
 bool
- static 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]
- static fieldsForEntityType(type: Qgis.SensorThingsEntity, includeRangeFieldProxies: bool = True) QgsFields[source]¶
 Returns the fields which correspond to a specified entity
type.Since QGIS 3.42 the
includeRangeFieldProxiesargument can be used to hide the “start”/”end” fields which are proxies for the date time range field types which are not natively supported in QGIS.- Parameters:
 type (Qgis.SensorThingsEntity)
includeRangeFieldProxies (bool = True)
- Return type:
 
- static fieldsForExpandedEntityType(baseType: Qgis.SensorThingsEntity, expandedTypes: Iterable[Qgis.SensorThingsEntity]) QgsFields[source]¶
 Returns the fields which correspond to a specified entity
baseType, expanded using the specified list ofexpandedTypes.Added in version 3.38.
- Parameters:
 baseType (Qgis.SensorThingsEntity)
expandedTypes (Iterable[Qgis.SensorThingsEntity])
- Return type:
 
- static filterForExtent(geometryField: str | None, extent: QgsRectangle) str[source]¶
 Returns a filter string which restricts results to those within the specified
extent.The
extentshould always be specified in EPSG:4326.Added in version 3.38.
- Parameters:
 geometryField (Optional[str])
extent (QgsRectangle)
- Return type:
 str
- static filterForWkbType(entityType: Qgis.SensorThingsEntity, wkbType: Qgis.WkbType) str[source]¶
 Returns a filter string which restricts results to those matching the specified
entityTypeandwkbType.- Parameters:
 entityType (Qgis.SensorThingsEntity)
wkbType (Qgis.WkbType)
- Return type:
 str
- static geometryFieldForEntityType(type: Qgis.SensorThingsEntity) str[source]¶
 Returns the geometry field for a specified entity
type.- Parameters:
 type (Qgis.SensorThingsEntity)
- Return type:
 str
- static geometryTypeForEntity(type: Qgis.SensorThingsEntity) Qgis.GeometryType[source]¶
 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:
 
- static propertiesForEntityType(type: Qgis.SensorThingsEntity) List[str][source]¶
 Returns the SensorThings properties which correspond to a specified entity
type.Added in version 3.38.
- Parameters:
 type (Qgis.SensorThingsEntity)
- Return type:
 List[str]
- static relationshipCardinality(baseType: Qgis.SensorThingsEntity, relatedType: Qgis.SensorThingsEntity)[source]¶
 Returns the cardinality of the relationship between a base entity type and a related entity type.
- Parameters:
 baseType (Qgis.SensorThingsEntity) – base entity type
relatedType (Qgis.SensorThingsEntity) -> (Qgis.RelationshipCardinality) – related entity type
- Returns:
 relationship cardinality
valid:
Trueif a relationship exists between the entity types, orFalseif no relationship exists
Added in version 3.38.
- static stringToEntity(type: str | None) Qgis.SensorThingsEntity[source]¶
 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: