Stream features

async AsyncCogniteClient.geospatial.stream_features(
feature_type_external_id: str,
filter: dict[str, Any] | None = None,
properties: dict[str, Any] | None = None,
allow_crs_transformation: bool = False,
allow_dimensionality_mismatch: bool = False,
) AsyncIterator[Feature]

Stream features.

This method allows to return any number of items until the underlying api calls times out. The order of the result items is not deterministic. If you need to order the results, use the search_features(…) method instead.

Parameters:
  • feature_type_external_id (str) – the feature type to search for

  • filter (dict[str, Any] | None) – the search filter

  • properties (dict[str, Any] | None) – the output property selection

  • allow_crs_transformation (bool) – If true, then input geometries will be transformed into the Coordinate Reference System defined in the feature type specification. When it is false, then requests with geometries in Coordinate Reference System different from the ones defined in the feature type will result in CogniteAPIError exception.

  • allow_dimensionality_mismatch (bool) – Indicating if the spatial filter operators allow input geometries with a different dimensionality than the properties they are applied to. Defaults to False.

Yields:

Feature – a generator for the filtered features

Examples

Stream features:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> my_feature = client.geospatial.create_features(
...     feature_type_external_id="my_feature_type",
...     feature=Feature(external_id="my_feature", temperature=12.4),
... )
>>> features = client.geospatial.stream_features(
...     feature_type_external_id="my_feature_type",
...     filter={"range": {"property": "temperature", "gt": 12.0}},
... )
>>> for f in features:
...     # do something with the features

Stream features and select output properties:

>>> features = client.geospatial.stream_features(
...     feature_type_external_id="my_feature_type",
...     filter={},
...     properties={"temperature": {}, "pressure": {}},
... )
>>> for f in features:
...     # do something with the features