-
Notifications
You must be signed in to change notification settings - Fork 7
/
const.ts
91 lines (78 loc) · 1.71 KB
/
const.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { Polygon, BBox as BBoxTurf, MultiPolygon } from '@turf/helpers';
import { ProcessingPayloadDatasource } from '../layer/processing';
export type StatisticalApiInputPayload = {
bounds: {
bbox?: BBoxTurf;
geometry?: Polygon | MultiPolygon;
properties: {
crs: string;
};
};
data: ProcessingPayloadDatasource[];
};
export type StatisticalApiAggregationPayload = {
timeRange: {
from: string;
to: string;
};
aggregationInterval: {
of: string;
};
width?: number;
height?: number;
resx?: number;
resy?: number;
evalscript: string;
};
export type StatisticalApiOutput = {
histograms?: any;
statistics?: any;
};
export type StatisticalApiCalculationsPayload = {
[output: string]: StatisticalApiOutput;
};
export type StatisticalApiPayload = {
input: StatisticalApiInputPayload;
aggregation: StatisticalApiAggregationPayload;
calculations: StatisticalApiCalculationsPayload;
};
type StatisticalApiResponseError = 'BAD_REQUEST' | 'EXECUTION_ERROR' | 'TIMEOUT';
type StatisticalApiResponseInterval = {
from: string;
to: string;
};
export type BandHistogram = {
overflow: number;
underflow: number;
bins: {
lowEdge: number;
mean: number;
count: number;
}[];
};
export type BandStats = {
min: number;
max: number;
mean: number;
stDev: number;
sampleCount: number;
noDataCount: number;
percentiles?: {
[percentile: string]: number;
};
};
type BandsType = {
[band: string]: {
stats: BandStats;
histogram?: BandHistogram;
};
};
export type StatisticalApiResponse = {
interval: StatisticalApiResponseInterval;
outputs: {
[output: string]: {
bands: BandsType;
};
};
error?: StatisticalApiResponseError;
}[];