List features
- async AsyncCogniteClient.geospatial.list_features(
- feature_type_external_id: str,
- filter: dict[str, Any] | None = None,
- properties: dict[str, Any] | None = None,
- limit: int | None = 25,
- allow_crs_transformation: bool = False,
-
This method allows to filter all features.
- Parameters:
feature_type_external_id (str) – the feature type to list features for
filter (dict[str, Any] | None) – the list filter
properties (dict[str, Any] | None) – the output property selection
limit (int | None) – Maximum number of features to return. Defaults to 25. Set to -1, float(“inf”) or None to return all features.
allow_crs_transformation (bool) – If true, then input geometries if existing in the filter 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.
- Returns:
The filtered features
- Return type:
Examples
List features:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> my_feature_type = client.geospatial.retrieve_feature_types( ... external_id="my_feature_type" ... ) >>> my_feature = client.geospatial.create_features( ... feature_type_external_id=my_feature_type, ... feature=Feature( ... external_id="my_feature", temperature=12.4, location={"wkt": "POINT(0 1)"} ... ), ... ) >>> res = client.geospatial.list_features( ... feature_type_external_id="my_feature_type", ... filter={"range": {"property": "temperature", "gt": 12.0}}, ... ) >>> for f in res: ... # do something with the features
Search for features and select output properties:
>>> res = client.geospatial.list_features( ... feature_type_external_id=my_feature_type, ... filter={}, ... properties={"temperature": {}, "pressure": {}}, ... )
Search for features with spatial filters:
>>> res = client.geospatial.list_features( ... feature_type_external_id=my_feature_type, ... filter={ ... "stWithin": { ... "property": "location", ... "value": {"wkt": "POLYGON((0 0, 0 1, 1 1, 0 0))"}, ... } ... }, ... )