Aggregate features

async AsyncCogniteClient.geospatial.aggregate_features(
feature_type_external_id: str,
filter: dict[str, Any] | None = None,
group_by: SequenceNotStr[str] | None = None,
order_by: Sequence[OrderSpec] | None = None,
output: dict[str, Any] | None = None,
) FeatureAggregateList

Aggregate filtered features.

Parameters:
  • feature_type_external_id (str) – the feature type to filter features from

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

  • group_by (SequenceNotStr[str] | None) – list of properties to group by with

  • order_by (Sequence[OrderSpec] | None) – the order specification

  • output (dict[str, Any] | None) – the aggregate output

Returns:

the filtered features

Return type:

FeatureAggregateList

Examples

Aggregate property of 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),
... )
>>> res = client.geospatial.aggregate_features(
...     feature_type_external_id="my_feature_type",
...     filter={"range": {"property": "temperature", "gt": 12.0}},
...     group_by=["category"],
...     order_by=[OrderSpec("category", "ASC")],
...     output={
...         "min_temperature": {"min": {"property": "temperature"}},
...         "max_volume": {"max": {"property": "volume"}},
...     },
... )
>>> for a in res:
...     # loop over aggregates in different groups