/
MapConfig.ts
211 lines (195 loc) · 4.13 KB
/
MapConfig.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*!
* Copyright 2021 Cognite AS
*/
/**
* Supported map Providers Bing, Here & Mapbox
*/
export enum MapProviders {
BingMap = 'BingMap',
HereMap = 'HereMap',
MapboxMap = 'MapboxMap',
OpenStreetMap = 'OpenStreetMap'
}
/**
* Map data for Mapbox
*/
export enum MapboxMode {
/**
* Access the map data using a map style. For details see https://docs.mapbox.com/api/maps/styles/
*/
Style = 100,
/**
* Access the map data using a map id or Tileset id. For details see https://docs.mapbox.com/help/glossary/tileset-id/
*/
Map_Id = 101
}
/**
* Mapbox Map Style, these are pre-defined styles using map/tileset id, created in Mapbox Studio style editor.
* This is used when MapboxMode.Style is used for mode.
*/
export enum MapboxStyle {
Streets = 'mapbox/streets-v10',
Outdoor = 'mapbox/outdoors-v10',
Light = 'mapbox/light-v9',
Dark = 'mapbox/dark-v9',
Satellite = 'mapbox/satellite-v9',
Satellite_Streets = 'mapbox/satellite-streets-v10',
Navigation_Day = 'mapbox/navigation-preview-day-v4',
Navigation_Night = 'mapbox/navigation-preview-night-v4',
Navigation_Guide_Day = 'mapbox/navigation-guidance-day-v4',
Navigation_Guide_Night = 'mapbox/navigation-guidance-night-v4'
}
/**
* A map/tileset ID is a unique identifier given to every tileset, used when MapboxMode.Map_Id is choosen for mode.
*/
export enum MapboxId {
Streets = 'mapbox.mapbox-streets-v7',
Satellite = 'mapbox.satellite',
Terrain = 'mapbox.mapbox-terrain-v2',
Traffic = 'mapbox.mapbox-traffic-v1',
TerrainRGB = 'mapbox.terrain-rgb'
}
/**
* Mapbox Map image tile format
*/
export enum MapboxImageFormat {
PNG = 'png',
PNG32 = 'png32',
PNG64 = 'png64',
PNG128 = 'png128',
PNG256 = 'png256',
JPG70 = 'jpg70',
JPG80 = 'jpg80',
JPG90 = 'jpg90',
PNGRAW = 'pngraw'
}
/**
* Bing Map View (aerial, road, bird's eye view of the map)
*/
export enum BingMapType {
Aerial = 'a',
Road = 'r',
Aerial_Labels = 'h',
Oblique = 'o',
Oblique_Labels = 'b'
}
/**
* Bing Map Tile Image formats
*/
export enum BingMapImageFormat {
GIF = 'gif',
JPEG = 'jpeg',
PNG = 'png'
}
/**
* Here Map types
*/
export enum HereMapType {
Aerial = 'aerial',
Base = 'base',
Pano = 'pano',
Traffic = 'traffic'
}
/**
* Here Map View Scheme like day, night, satellite, terrain
*/
export enum HereMapScheme {
Day = 'normal.day',
Night = 'normal.night',
Terrain = 'terrain.day',
Satellite = 'satellite.day'
}
/**
* Here Map Tiles Image Format
*/
export enum HereMapImageFormat {
PNG = 'png',
PNG8 = 'png8',
JPG = 'jpg'
}
export type BingMapConfig = {
provider: MapProviders.BingMap;
/**
* Bing Map API Key
*/
APIKey: string;
/**
* The type of the map used.
*/
type?: BingMapType;
};
export type HereMapConfig = {
provider: MapProviders.HereMap;
/**
* Here map API Key
*/
APIKey: string;
/**
* Service application code token.
*/
appCode?: string;
/**
* The type of maps to be used.
*/
style?: HereMapType;
/**
* Specifies the view scheme
*/
scheme?: string;
/**
* Map image tile format
*/
imageFormat?: HereMapImageFormat;
/**
Returned tile map image size.
The following sizes are supported:
- 256
- 512
- 128 (deprecated, although usage is still accepted)
*/
size?: number;
};
export type OpenStreetMapConfig = {
provider: MapProviders.OpenStreetMap;
};
export type MapboxConfig = {
provider: MapProviders.MapboxMap;
/**
* Mapbox API Key
*/
APIKey: string;
/**
* Map style or map ID if the mode is set to MAP_ID
*/
id: string;
/**
Map tile access mode
- MapboxMode.STYLE
- MapboxMode.MAP_ID
*/
mode?: MapboxMode;
/**
* Map image tile format
*/
tileFormat?: MapboxImageFormat;
/**
* Flag to indicate if should use high resolution tiles
*/
useHDPI?: boolean;
};
/**
* Maps Configuration of {@link GeomapTool}.
*/
export type MapConfig = {
/**
* Latitude, Longitude position
*/
latlong: LatLongPosition;
} & (BingMapConfig | HereMapConfig | MapboxConfig | OpenStreetMapConfig);
/**
* Latitude, Longitude position.
*/
export type LatLongPosition = {
latitude: number;
longitude: number;
};