/
computeAPI.ts
36 lines (35 loc) · 1.05 KB
/
computeAPI.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { BaseResourceAPI } from '@cognite/sdk-core';
import {
GeospatialJsonComputeOutput,
GeospatialComputedItemList,
} from './types';
export class ComputeAPI extends BaseResourceAPI<GeospatialComputedItemList> {
/**
* [Compute custom json output structures or well known binary format responses based on calculation or selection of feature properties or direct values given in the request.](https://docs.cognite.com/api/v1/#operation/compute)
*
* ```js
*
* const response = await client.geospatial.compute.compute({
* output: {
* "output": {
* stTransform: {
* geometry: {
* ewkt: "SRID=4326;POLYGON((0 0,10 0,10 10,0 10,0 0))"
* },
* srid: 4326,
* }
* }
* }
* });
* ```
*/
public compute = async (
request: GeospatialJsonComputeOutput
): Promise<GeospatialComputedItemList> => {
const path = this.url();
const response = await this.post<GeospatialComputedItemList>(path, {
data: request,
});
return response.data;
};
}