I’m trying to upload a raster file to cdf, but I get this error message when trying to create the feature type.
cognite.client.exceptions.CogniteAPIError: RASTER properties only support embedded storage. | code: 400 | X-Request-ID: 21781349-8ad8-9710-abdb-7c7199a268e7
raster_ft = FeatureType(
external_id="Raster_ft",
data_set_id=1,
properties={
"raster": {"type": "RASTER"}
}
)
client.geospatial.create_feature_types(raster_ft) # gives error message
Is this the right method to upload a raster to cdf? I found a method put_raster() in the docs, but it seems to require feature and feature type to be created already. The rest of my code:
# create raster feature
feature = Feature(
external_id=f'raster.test',
data_set_id=1,
raster=open(raster_filepath) # What do I put here?
)
client.geospatial.create_features(feature_type_external_id='Raster_ft', feature=feature)
# looks like I need the feature with the raster property, do I need this function?
client.geospatial.put_raster(
feature_type_external_id=raster_ft.external_id,
feature_external_id=feature.external_id,
raster_property_name='raster',
raster_format='XYZ',
raster_srid='32633',
file=raster_filepath
)