Create features
- async AsyncCogniteClient.geospatial.create_features(
- feature_type_external_id: str,
- feature: Feature | FeatureWrite | Sequence[Feature] | Sequence[FeatureWrite] | FeatureList | FeatureWriteList,
- allow_crs_transformation: bool = False,
- chunk_size: int | None = None,
-
Deprecated since version 8.23.0: The Geospatial API is deprecated and is scheduled for removal on 2027-12-31. There is no replacement in the data modeling service; plan to stop using it. See https://docs.cognite.com/cdf/deprecated for details and migration guidance.
- Parameters:
feature_type_external_id (str) – Feature type definition for the features to create.
feature (Feature | FeatureWrite | Sequence[Feature] | Sequence[FeatureWrite] | FeatureList | FeatureWriteList) – one feature or a list of features to create or a FeatureList object
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.
chunk_size (int | None) – maximum number of items in a single request to the api
- Returns:
Created features
- Return type:
Examples
Create a new feature type and corresponding feature:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes.geospatial import FeatureTypeWrite, FeatureWrite >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> feature_types = [ ... FeatureTypeWrite( ... external_id="my_feature_type", ... properties={ ... "location": {"type": "POINT", "srid": 4326}, ... "temperature": {"type": "DOUBLE"}, ... }, ... ) ... ] >>> res = client.geospatial.create_feature_types(feature_types) >>> res = client.geospatial.create_features( ... feature_type_external_id="my_feature_type", ... feature=FeatureWrite( ... external_id="my_feature", location={"wkt": "POINT(1 1)"}, temperature=12.4 ... ), ... )