-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.d.ts
178 lines (161 loc) · 3.69 KB
/
index.d.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// Type definitions for GeoStyler Data Models
// Project: https://github.com/geostyler/geostyler
// Definitions by: Christian Mayer <https://github.com/chrismayer>
// Definitions:
// TypeScript Version: 3.3.3
import { FeatureCollection, Geometry } from 'geojson';
import { JSONSchema4TypeName } from 'json-schema';
/**
* Type represents a single property of an object according to JSON schema.
* Like:
*
* {
* "type": "Number",
* "minimum": 0
* }
*
*
* @class SchemaProperty
*/
export type SchemaProperty = {
/**
* The data type of the described property / attribute
* @type {JSONSchema4TypeName}
*/
type: JSONSchema4TypeName;
/**
* The minimum value of the described property / attribute.
* Only applies for type='number'
* @type {number}
*/
minimum?: number;
/**
* The data type of the described property / attribute#
* Only applies for type='number'
* @type {number}
*/
maximum?: number;
};
/**
* Type represents the schema of imported geo-data, to have information about available
* properties and data ranges.
* Comparable to a DescribeFeatureType response for an OGC WFS.
* This is modelled as JSON schema:
*
* {
* "title": "Person",
* "type": "object",
* "properties": {
* "firstName": {
* "type": "string"
* },
* "lastName": {
* "type": "string"
* },
* "age": {
* "description": "Age in years",
* "type": "integer",
* "minimum": 0
* }
* }
* }
*
* @type DataSchema
*/
export type DataSchema = {
/**
* Optional title for the described entity
*
* @type {string}
*/
title?: string;
/**
* Type definition for the described entity
*
* @type {string}
*/
type: string;
/**
* Properties object describing the attributes of the described entity
*
* @type {[name: string]: SchemaProperty; }}
*/
properties: { [name: string]: SchemaProperty };
};
/**
* Type represents the schema of imported raster-data,
* to have information about a single band.
*
* @type BandSchema
*/
export type BandSchema = {
[key: string]: any;
minValue?: number;
maxValue?: number;
};
/**
* BaseData object
*/
export interface BaseData {
/**
* Schema of imported geo-data describing the properties / attributes
*
* @type {DataSchema}
*/
schema: DataSchema;
}
/**
* Internal data object for imported vector geo data.
* Aggregates a data schema and some example data (FeatureCollection).
*/
export interface VectorData extends BaseData {
/**
* Example features of imported geo-data
*/
exampleFeatures: FeatureCollection<Geometry>;
}
/**
* Internal data object for imported raster data.
* Aggregates a data schema and some example data.
*/
export interface RasterData extends BaseData {
/**
* Info on imported raster bands.
* Each band should be a unique key with arbitrary subproperties.
* These can include projections, statistics and other information.
*/
rasterBandInfo: {[bandname: string]: BandSchema };
}
/**
* Internal data object for imported geo data.
*/
export type Data = RasterData | VectorData;
/**
* Interface, which has to be implemented by all GeoStyler parser classes.
*/
export interface DataParser {
/**
* The name of the Parser instance
*/
title: string;
/**
* Optional projection of the input data,
* e.g. 'EPSG:4326'
*
* @type {string}
*/
sourceProjection?: string;
/**
* Optional projection of the output data,
* e.g. 'EPSG:3857'
*
* @type {string}
*/
targetProjection?: string;
/**
* Parses the inputData and transforms it to the GeoStyler data model
*
* @param inputData
*/
readData(inputData: any): Promise<Data>;
}