@metoceanapi/wxtiles-leaflet 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +137 -305
  3. package/dist/es/defaults/styles.d.ts +2 -2
  4. package/dist/es/defaults/uconv.d.ts +2 -2
  5. package/dist/es/index.d.ts +31 -4
  6. package/dist/es/index.js +1 -1
  7. package/dist/es/utils/RawCLUT.d.ts +32 -22
  8. package/dist/es/utils/qtree.d.ts +11 -5
  9. package/dist/es/utils/wxtools.d.ts +226 -60
  10. package/dist/es/wxAPI/WxDataSetManager.d.ts +65 -35
  11. package/dist/es/wxAPI/wxAPI.d.ts +115 -43
  12. package/dist/es/wxlayer/WxImplementation.d.ts +74 -32
  13. package/dist/es/wxlayer/loader.d.ts +27 -3
  14. package/dist/es/wxlayer/loadertools.d.ts +41 -3
  15. package/dist/es/wxlayer/painter.d.ts +39 -0
  16. package/dist/es/wxlayer/wxlayer.d.ts +77 -9
  17. package/dist/es/wxsource/wxsource.d.ts +60 -20
  18. package/dist/es/wxsource/wxsourcetypes.d.ts +13 -0
  19. package/dist/web/index.js +1 -1
  20. package/docs/docs/assets/highlight.css +92 -0
  21. package/docs/docs/assets/main.js +54 -0
  22. package/docs/docs/assets/search.js +1 -0
  23. package/docs/docs/assets/style.css +1257 -0
  24. package/docs/docs/classes/FrameworkParentClass.html +86 -0
  25. package/docs/docs/classes/Loader.html +165 -0
  26. package/docs/docs/classes/Painter.html +161 -0
  27. package/docs/docs/classes/QTree.html +129 -0
  28. package/docs/docs/classes/RawCLUT.html +143 -0
  29. package/docs/docs/classes/WxAPI.html +336 -0
  30. package/docs/docs/classes/WxDataSetManager.html +389 -0
  31. package/docs/docs/classes/WxLayer.html +363 -0
  32. package/docs/docs/classes/WxLayerBaseImplementation.html +358 -0
  33. package/docs/docs/classes/WxTileSource.html +435 -0
  34. package/docs/docs/enums/TileType.html +80 -0
  35. package/docs/docs/functions/WXLOG.html +118 -0
  36. package/docs/docs/functions/WxCreateLegend.html +126 -0
  37. package/docs/docs/functions/WxGetColorSchemes.html +113 -0
  38. package/docs/docs/functions/WxGetColorStyles.html +113 -0
  39. package/docs/docs/functions/WxTilesLogging.html +118 -0
  40. package/docs/docs/index.html +199 -0
  41. package/docs/docs/interfaces/ColorStylesIncomplete.html +116 -0
  42. package/docs/docs/interfaces/Converter.html +81 -0
  43. package/docs/docs/interfaces/DataIntegral.html +112 -0
  44. package/docs/docs/interfaces/DataPicture.html +93 -0
  45. package/docs/docs/interfaces/FrameworkOptions.html +118 -0
  46. package/docs/docs/interfaces/IntegralPare.html +81 -0
  47. package/docs/docs/interfaces/SLinePoint.html +77 -0
  48. package/docs/docs/interfaces/Tree.html +70 -0
  49. package/docs/docs/interfaces/WxAPIOptions.html +164 -0
  50. package/docs/docs/interfaces/WxAllBoundariesMeta.html +85 -0
  51. package/docs/docs/interfaces/WxBoundaryMeta.html +91 -0
  52. package/docs/docs/interfaces/WxColorSchemes.html +117 -0
  53. package/docs/docs/interfaces/WxColorStyleStrict.html +299 -0
  54. package/docs/docs/interfaces/WxColorStyleWeak.html +325 -0
  55. package/docs/docs/interfaces/WxColorStylesStrict.html +74 -0
  56. package/docs/docs/interfaces/WxColorStylesWeakMixed.html +116 -0
  57. package/docs/docs/interfaces/WxData.html +81 -0
  58. package/docs/docs/interfaces/WxDataSetManagerOptions.html +108 -0
  59. package/docs/docs/interfaces/WxDataSetsMetasJSON.html +75 -0
  60. package/docs/docs/interfaces/WxDatasetMeta.html +135 -0
  61. package/docs/docs/interfaces/WxDatasetShortMeta.html +90 -0
  62. package/docs/docs/interfaces/WxLayerAPI.html +313 -0
  63. package/docs/docs/interfaces/WxLayerBaseAPI.html +246 -0
  64. package/docs/docs/interfaces/WxLayerOptions.html +111 -0
  65. package/docs/docs/interfaces/WxLegend.html +117 -0
  66. package/docs/docs/interfaces/WxLngLat.html +81 -0
  67. package/docs/docs/interfaces/WxRasterData.html +99 -0
  68. package/docs/docs/interfaces/WxRequestInit.html +70 -0
  69. package/docs/docs/interfaces/WxTick.html +99 -0
  70. package/docs/docs/interfaces/WxTileInfo.html +142 -0
  71. package/docs/docs/interfaces/WxTilesLibOptions.html +92 -0
  72. package/docs/docs/interfaces/WxUnits.html +116 -0
  73. package/docs/docs/interfaces/WxVariableMeta.html +108 -0
  74. package/docs/docs/interfaces/WxVariablesMetas.html +116 -0
  75. package/docs/docs/interfaces/XYZ.html +84 -0
  76. package/docs/docs/modules.html +208 -0
  77. package/docs/docs/types/DataIntegrals.html +109 -0
  78. package/docs/docs/types/DataPictures.html +109 -0
  79. package/docs/docs/types/SLine.html +109 -0
  80. package/docs/docs/types/SubTrees.html +109 -0
  81. package/docs/docs/types/SubTreesN.html +109 -0
  82. package/docs/docs/types/TreeN.html +109 -0
  83. package/docs/docs/types/UriLoaderPromiseFunc.html +129 -0
  84. package/docs/docs/types/WxDate.html +109 -0
  85. package/docs/docs/types/WxURIs.html +109 -0
  86. package/docs/docs/types/WxUnitTuple.html +109 -0
  87. package/docs/docs/types/WxVars.html +109 -0
  88. package/docs/script/script.css +1 -1
  89. package/docs/script/script.js +6 -6
  90. package/package.json +8 -8
  91. package/src_example/index.ts +12 -7
package/CHANGELOG.md CHANGED
@@ -9,6 +9,10 @@ Write your changes below this section. `npm version [major|minor|patch]` will au
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [2.0.6] - 2022-11-27
13
+
14
+ ## [2.0.5] - 2022-11-24
15
+
12
16
  ## [2.0.4] - 2022-11-18
13
17
 
14
18
  ### add
package/README.md CHANGED
@@ -1,357 +1,189 @@
1
- # Wxtiles-leaflet lib
1
+ # wxtiles
2
2
 
3
- JS lib based on Leaflet https://leafletjs.com
4
- Data tiles are from https://tiles.metoceanapi.com
3
+ This is a project for weather data visualization.
4
+ There are three main parts of the project:
5
5
 
6
- # demo and examples
6
+ 1. [Splitter](https://github.com/metocean/wxtile-splitter) - a service that splits the datasets into tiles (PNG) and some metadata (JSON) served by a fileserver backend aka NGINX.
7
+ 2. [WxTiles-mbox source code](https://github.com/metoceanapi/wxtiles-mbox), npm [@metoceanapi/wxtiles-mbox](https://www.npmjs.com/package/@metoceanapi/wxtiles-mbox) - a JS API providing work with metadata, dataset manager and an implementation of a Custom MapBox-gl-gs Layer for visualizing the tiles using [Mapbox-gl-gs](https://www.mapbox.com/).
8
+ 3. [WxTiles-leaflet source code](https://github.com/metoceanapi/wxtiles-leaflet), npm [@metoceanapi/wxtiles-leaflet](https://www.npmjs.com/package/@metoceanapi/wxtiles-leaflet) - a JS API providing work with metadata, dataset manager and an implementation of a Custom Leaflet Layer for visualizing the tiles using [Leaflet](https://leafletjs.com/).
7
9
 
8
- To see a demo running:
10
+ ## DOCS
9
11
 
10
- ```
11
- npm install
12
- npm run start
13
- ```
14
-
15
- Demo code is found in
16
-
17
- ```
18
- public/index.html
19
- public/index.js
20
- ```
21
-
22
- Folder Examples contains standalone workable html examples.
12
+ - Mapbox-gl: https://metoceanapi.github.io/wxtiles-mbox/docs/
13
+ - Leaflet: https://metoceanapi.github.io/wxtiles-leaflet/docs/
23
14
 
24
- # API. Functions
15
+ ## API
25
16
 
26
- ## WxTileLibSetup({ colorStyles, units, colorSchemes } = {})
17
+ APIs for Leaflet and Mapbox-gl-gs are similar, but they have different implementations of the Custom Source/Layer.
27
18
 
28
- Wxtile lib must be initialized before use.
19
+ ## Examples
29
20
 
30
- ## WxGetColorStyles()
21
+ ### MapBox-gl-js
31
22
 
32
- Get all style objects. See 'styles'
23
+ ```ts
24
+ import 'mapbox-gl/dist/mapbox-gl.css';
25
+ import mapboxgl from 'mapbox-gl';
26
+ import { WxAPI } from '@metoceanapi/wxtiles-mbox';
33
27
 
34
- ## WxTileLayer(settings)
28
+ async func(){
29
+ // Get the API ready - should be ONE per application
30
+ // requestInit is used in every request to the server. Add your keys, credentials, mode, etc.
31
+ const wxapi = new WxAPI({ dataServerURL: 'https://tiles.metoceanapi.com/data/',
32
+ requestInit: { /* headers: new Headers([['x-api-key', 'key']]), */ } });
35
33
 
36
- See Layer.initialize
34
+ // Create a dataset manager (may be used for many variables-layers from this dataset)
35
+ const wxdatasetManager = await wxapi.createDatasetManager('gfs.global');
37
36
 
38
- ## WxTileLogging(bool:on = false)
37
+ // Automatically gets a proper set of variable(s) from the dataset and composes northward or eastward components if needed
38
+ const variables = wxdatasetManager.checkCombineVariableIfVector('air.temperature.at-2m'); // 'wind.speed.eastward.at-10m' - Vector example
39
39
 
40
- Print vast logs to consol.
40
+ // create a Mapbox layer source
41
+ const mboxSourceOptions = { id: 'wxsource', attribution: 'WxTiles' };
42
+ const wxsource = new WxTileSource({ wxdatasetManager, variables }, mboxSourceOptions);
41
43
 
42
- ## WxGetInternalLeafletCopy()
44
+ // add the layer to the map
45
+ const map = new mapboxgl.Map({ container: 'map', accessToken:'token', style: { version: 8, name: 'Empty', sources: {}, layers: [] } });
46
+ await map.once('load');
47
+ map.addSource(wxsource.id, wxsource);
48
+ map.addLayer({ id: 'wxlayer', type: 'raster', source: wxsource.id, paint: { 'raster-fade-duration': 0 /*NEDDED for animation*/ } });
49
+ }()
43
50
 
44
- Get the Leaflet library bundled with Wxtiles.
45
-
46
- ## WxTileWatermark(params)
47
-
48
- params - Leaflet control's parameters
49
-
50
- # API. Layer Objects
51
-
52
- ## constructor: initialize({ dataSource, options = {}, lazy = true })
53
-
54
- ```js
55
- dataSource = {
56
- serverURI: string, // server to fetch data from
57
- ext: string, // png / webp (default) - wxtilesplitter output format
58
- dataset: string, // dataset of the dataset
59
- variables: [string, string] // variable(s) to be used for the layer rendering
60
- name: string, // attribute of the dataSource to be used externally
61
- styleName: string, // The name of the style (from styles.json) to apply for the layer
62
- }
63
- // Lazy setup
64
- // 'true': perform setup and data loading on 'addTo(map)'.
65
- // 'false': start loading immediately, but loading is not finished when layer is created.
66
- // the signal 'setupcomplete' is fired when loading is finished.
67
- // useful when a big bunch of layers is used, so layers are not wasting memory and bandwidth.
68
- lazy: bool
69
-
70
- options = { // Lealet's options for the layer
71
- opacity: 1,
72
- }
73
51
  ```
74
52
 
75
- ## getSetupCompletePromise() : Promise<void>
76
-
77
- As setup process is async, this function returns the promise which is resolved upon setup complete.
53
+ ### Leaflet
78
54
 
79
- ## once('setupcomplete', func(){})
55
+ ```ts
56
+ import 'leaflet/dist/leaflet.css';
57
+ import L from 'leaflet';
58
+ import { WxAPI } from '@metoceanapi/wxtiles-leaflet';
80
59
 
81
- It is a Leaflet's feature.
82
- _func_ - a callback called upon setup complete.
60
+ async func(){
61
+ // Get the API ready - should be ONE per application
62
+ // requestInit is used in every request to the server. Add your keys, credentials, mode, etc.
63
+ const wxapi = new WxAPI({ dataServerURL: 'https://tiles.metoceanapi.com/data/',
64
+ requestInit: { /* headers: new Headers([['x-api-key', 'key']]), */ } });
83
65
 
84
- ## createTile(coords: obj, done: function)
66
+ // Create a dataset manager (may be used for many variables-layers from this dataset)
67
+ const wxdatasetManager = await wxapi.createDatasetManager('gfs.global');
85
68
 
86
- Leaflet calls this function to create tiles.
69
+ // Automatically gets a proper set of variable(s) from the dataset and composes northward or eastward components if needed
70
+ const variables = wxdatasetManager.checkCombineVariableIfVector('air.temperature.at-2m'); // 'wind.speed.eastward.at-10m' - Vector example
87
71
 
88
- ## getTile(latlng) : obj
72
+ // create a layer
73
+ const leafletOptions: L.GridLayerOptions = { opacity: 1, attribution: 'WxTiles' };
74
+ const wxsource = new WxTileSource({ wxdatasetManager, variables }, leafletOptions);
89
75
 
90
- ```js
91
- latlng = { lat: num, lon: num };
92
- obj = { tile: obj, data: num, raw: uint16, rgba: Uint32, hexColor: string, inStyleUnits: num, tilePoint: { x, y }, units: string };
76
+ // add the layer to the map
77
+ const map = L.map('map', { center: [0, 0], zoom: 2, zoomControl: true });
78
+ map.addLayer(wxsource);
79
+ await new Promise((done) => wxsource.once('load', done)); // highly recommended to await for the first load
80
+ }()
93
81
  ```
94
82
 
95
- **tile** - internal wxtile-js lib object.
96
- **raw** - raw representation of data at latlng
97
- **data** - data at latlng
98
- **inStyleUnits** - data at latlng converted into style units.
99
- **rgba** - uint32 representation of the color at latlng
100
- **hexColor** - web format of the color reprensentation at latlng
101
- **tilePoint** - {x, y} (0-256) projection of the latlng on the tile.
102
- **units** - style units
103
-
104
- ## setStyle(name: string)
105
-
106
- **name** - a name of a style object in _styles.json_. (Warning! it is not an internal 'name' _in_ the style)
107
-
108
- ## getStyle() : string
109
-
110
- Get the 'name' of the layer's style object used for rendering.
111
-
112
- ## getStyleName() : string
113
-
114
- Get an internal 'name' of the layer's style.
115
-
116
- ## setTime(unixTime: number) : Promise<void>
117
-
118
- _unixTime_ - milliseconds since Jan 1, 1970, 00:00:00.000 GMT
119
- _Promise_ is resolved when new data is loaded and rendered. _Undefined_ if error ocured.
120
-
121
- ## getTime() : string
122
-
123
- Get current layer's _time step_ used for rendering.
124
-
125
- ## getTimes()
126
-
127
- Get all layer's _time steps_.
128
-
129
- ## checkDataChanged() : Promise<bool>
83
+ ### Change the time step
130
84
 
131
- resolved as _true_ if there is a new instance of data.
132
-
133
- ## reloadData() : Promise<void>
134
-
135
- Forces layer to reload data
136
-
137
- ## getLegendData(legendSize: number): obj
138
-
139
- Returns style's metadata usefull for legend rendering
140
- _legendSize_ - width of a legend.
141
-
142
- ```js
143
- obj = { size: number, showBelowMin: bool, showAboveMax: bool, units: string, colors: Uint32Array(size), ticks: [tickobj] };
144
- tickobj = { data: number, dataString: string, color: string, pos: number };
85
+ ```ts
86
+ await wxsource.setTimeStep(1); // 1 - index of the time step in the dataset
145
87
  ```
146
88
 
147
- _size_ = legendSize
148
- _showBelowMin_ - usefull to show somehow on a legend that data is shown (or not) below the legend's minimum
149
- _showAboveMax_ - usefull to show somehow on a legend that data is shown (or not) above the legend's maximum
150
- _units_ - style's units
151
- _colors_ - array of RGBA.
152
-
153
- _tick_ - metadata for ticks on the legend
154
- _data_ - data in style's units
155
- _dataString_ - string representation of a data (formated).
156
- _color_ - web color at the tick
157
- _pos_ - legend's X coord for the tick (0, legendSize)
158
-
159
- ## setCoarseLevel(l = 2)
160
-
161
- Prepares layer to be time-animated. Reduces level of detalization, so dramaticaly reduces downloaded data during animation.
162
-
163
- ## unsetCoarseLevel()
164
-
165
- Restores level of detalization to the level's maximum.
166
-
167
- # WxTile Data structure
168
-
169
- See https://github.com/metocean/wxtile-splitter
170
-
171
- ## Styles, unrolling and inheritance
172
-
173
- 'styles.json' contains a set of styles. It is processsed in order to aplly 'unrolling' and 'inheritance'
89
+ or
174
90
 
175
- 'unrolling' and 'inheritance' example:
176
-
177
- ```js
178
- {
179
- "variableName": [ // style can be arrays of styles. Usefull when many styles are set for one variable.
180
- {
181
- "name": "super 0",
182
- "....": "..."
183
- },
184
- {
185
- "name": "super 1",
186
- "....": "..."
187
- },
188
- {
189
- "name": "super 2",
190
- "parent": "variablName[1]",
191
- "....": "..."
192
- }
193
- ]
194
- }
91
+ ```ts
92
+ await wxsource.setTimeStep('2020-01-01T00:00:00Z'); // '2020-01-01T00:00:00Z' - time step in the dataset
195
93
  ```
196
94
 
197
- unrolled to
198
-
199
- ```json
200
- {
201
- // NOTE: order number in array is added to the arrayed-style, so each style becomes independent
202
- "variableName[0]": {
203
- "name": "super 0",
204
- "....": "..."
205
- },
206
- // So, as an example of inheritance, 'variableName[1]' could be used as a parent for variableName[2]
207
- "variableName[1]": {
208
- "name": "super 1",
209
- "....": "..."
210
- },
211
- // So, as an example of inheritance, 'variableName[1]' could be used as a parent for variableName[2]
212
- "variableName[2]": {
213
- "name": "super 2",
214
- "parent": "variableName[1]",
215
- "....": "..."
216
- }
217
- }
218
- ```
95
+ or
219
96
 
220
- ## fields of a style
221
-
222
- ```js
223
- {
224
- "parent": "base", /* parent the style. Usefull within the inharitance system.
225
- If presented in 'styles.json', to fullfill this style the parentstyle is ammended with fields of this style.
226
- multi-inheritance is acceptable, so parent style can have its own parent etc
227
- if no parent specified parent="base" is used. "base" style must be in 'styles.json'
228
- NOTE: useless for hot 'custom' style - dirty hack acccepted by wxtile-js lib.*/
229
- "name": "Style name to be showed on legend",
230
- "fill": "gradient(default)/solid/none",
231
- "isolineColor": "inverted(default)/fill/none",
232
- "isolineText": true, // make text on isolines visible (default: true)
233
- "showBelowMin": true, // make invisible(if false) data below minimud level data.
234
- "showAboveMax": true, // make invisible(if false) data above minimud level data.
235
- "blurRadius": 0, // apply BoxBlur to fetched data
236
- "addDegrees": 0, // rotation of arrows. Usefull for currents and winds in some cases with data units 'degree' to coorect rotation of original data if needed.
237
- "vectorColor": "inverted/fill/none(default)/#xxxxxxxx", /* color of vectors:
238
- "none" - (default) don't render vectors,
239
- "inverted" - inverted color for current data,
240
- "fill" - color for current data,
241
- "#ffffffff" - const color (web format) for all vectors.*/
242
- "vectorType": "arrows(default)/barbs", /*the name of the font used for vector rendering.
243
- "none" - (default) don't render vectors,
244
- "vector" - arrows
245
- "barbs" - barbs*/
246
- "streamLineColor": "none/#888", // in web color scheme "#rgb" or "#rrggbb" "#rrggbbaa". "none" - no particle animation
247
- "streamLineSpeedFactor": 3, // factor to make stream lines longer (particles faster).
248
- "streamLineStatic": false, // don't animate streamlines, draw a 'curve' instead.
249
- "levels": [0, 0.25, 0.75, 1, 1.5, 2], /* levels of data for legend and isolines.
250
- if "levels" is null, then 10 levels in [min, max] are autocreated.
251
- Ignored if 'colorMap' is not null*/
252
- "colorScheme": "rainbow", /*predefined colorsceme in 'colorschemes.json' (ignored if 'colors' or 'colorMap' is not null):
253
- "rainbow" (default), used if there is no colorscheme in a style)
254
- "rainbow2"
255
- "bluebird"
256
- "bw"
257
- "wb"
258
- "redish"
259
- "greenish"
260
- "blueish"*/
261
- "colors": ["#5E6472FF", "#AED9E0FF", "#B3E6E3FF", "#B8F2E6FF", "#FAF3DDFF", "#FFA69EFF"], // legend's linear colorscheme. Ignored if 'colorMap' is not null)
262
- "colorMap": [ // array of levels and corresponding colors. Non-linear representation of a colorscheme
263
- [0, "#323200ff"], // level value (in style's units), color
264
- [16, "#ffff00ff"],[20, "#ffff00ff"],[20, "#0032a0ff"],[30, "#0050ffff"],[30, "#006496ff"],[40, "#00ffffff"],...
265
- ],
266
- "units": "speedOfLight", // representation of the layer's data (data is converted if necessary)
267
- "extraUnits": {"speedOfLight": ["m/s", 299792458, 0]} // append default unit converter system with new units: "speedOfLight" = "m/s" * 299792458 + 0;
268
- }
97
+ ```ts
98
+ await wxsource.setTimeStep(2345323454); // time in seconds since 1970-01-01T00:00:00Z
269
99
  ```
270
100
 
271
- ## Colors defined as a string (web format)
272
-
273
- The basic information could be found here: https://en.wikipedia.org/wiki/Web_colors#Hex_triplet
274
- In addition to 'standard' triplets, in 'wxtile-js' lib four bytes could be used to represent RGBA (transparancy).
275
- Color defenition is "case insensitive".
101
+ or
276
102
 
277
- #ffd700 = #FFD700 = #FFD700FF (opaque, "case insensitive")
278
- #FFD7007F (semi transparent)
103
+ ```ts
104
+ await wxsource.setTimeStep(new Date('2020-01-01T00:00:00Z')); // Date object
105
+ ```
279
106
 
280
- #f6e = #ff66EE = #ff66eeff (opaque)
281
- #0aF = #00AAff = #00AAFFFF (opaque)
107
+ ### Update the style
282
108
 
283
- # Color schemes
109
+ ```ts
110
+ await wxsource.updateCurrentStyleObject({ units: 'm/s', levels: undefined }); // levels: undefined - to recalculate levels
111
+ ```
284
112
 
285
- colorschemes.json
113
+ ### Preload the time steps
286
114
 
287
- ```js
288
- {
289
- "rainbow": [ // Name of a colorscheme
290
- "#ff0000ff", // string representation of RGBA color,
291
- "#ffff00ff",
292
- "#00ff00ff",
293
- "#00ffffff",
294
- "#0000ffff",
295
- "#ff00ffff"
296
- ],
297
- ...
298
- }
115
+ ```ts
116
+ // load to the cache the time steps 10 but not render it
117
+ const prom = wxsource.preloadTime(10);
118
+ // do stuff asyncronously
119
+ // ...
120
+ await prom; // wait for the time step to finish loading
121
+ // now set the time step to 10
122
+ await wxsource.setTime(10); // will be rendered from the cache
299
123
  ```
300
124
 
301
- # Units convertion
302
-
303
- Units converter works ONLY with units from this file.
304
- It considers "m/s" and "m s\*\*-1" as different units.
305
- NOTE!!! Units in the first column are taken from dataset data files.
306
- NOTE!!! Units int the `uconv.json` are case-sensitive.
125
+ ### Abort loading
307
126
 
308
- ## Example:
127
+ ```ts
128
+ const abortController = new AbortController();
129
+ console.log('setTime(5)');
130
+ const prom = wxsource.setTime(5, abortController);
131
+ abortController.abort(); // aborts the request
132
+ await prom; // await always !! even if aborted
133
+ console.log('aborted');
134
+ ```
309
135
 
310
- Base units for "knot" is "m/s",
311
- Base units for "km/h" is "m/s", so "knot" and "km/h" are convertible.
312
- Convertion is always two-staged, forward - units-1 to its base units, backward - from base units to units-2.
313
- to convert 5 "knot" to "km/h":
136
+ ### Get the current time step
314
137
 
138
+ ```ts
139
+ const timeStep = wxsource.getTime();
315
140
  ```
316
- "knot": ["m/s", 0.514444],
317
- "km/h": ["m/s", 0.27777777777],
318
141
 
319
- ```
142
+ ### read lon lat data
320
143
 
321
- 1. 5 knot = 5 \* 0.514444 = 2,57222 m/s -- forward
322
- 2. 2,57222 / 0.277777777 = 9.26 km/h -- backward
323
-
324
- ## 'uconv.json' example
325
-
326
- ```json
327
- {
328
- "K": ["K", 1],
329
- "F": ["K", 0.5555555555, 255.372222222],
330
- "C": ["K", 1, 273.15],
331
- "degC": ["K", 1, 273.15],
332
- "kg/m^2/s": ["kg/m^2/s", 1],
333
- "Kg m**-2 s**-1": ["kg/m^2/s", 1],
334
- "W/m^2": ["W/m^2", 1],
335
- "W m**2": ["W/m^2", 1],
336
- "m/s": ["m/s", 1],
337
- "m s**-1": ["m/s", 1],
338
- "knot": ["m/s", 0.514444],
339
- "km/h": ["m/s", 0.27777777777],
340
- "s": ["s", 1],
341
- "sec": ["s", 1],
342
- "h": ["s", 3600],
343
- "min": ["s", 60],
344
- "m": ["m", 1],
345
- "cm": ["m", 0.01],
346
- "inch": ["m", 0.0254]
347
- }
144
+ ```ts
145
+ map.on('mousemove', (e) => {
146
+ if (!wxsource) return;
147
+ const pos = position(e); //
148
+ const tileInfo: WxTileInfo | undefined = wxsource.getLayerInfoAtLatLon(pos.wrap(), map);
149
+ if (tileInfo) {
150
+ console.log(tileInfo);
151
+ }
152
+ });
348
153
  ```
349
154
 
350
- # ToDos:
155
+ ### animated blur effect
351
156
 
352
- 1. animated `degrees` like wave direction (minor)
157
+ ```ts
158
+ let b = 0;
159
+ let db = 1;
160
+ const nextAnim = async () => {
161
+ if (!wxsource) return;
162
+ await wxsource.updateCurrentStyleObject({ blurRadius: b }); // await always !!
353
163
 
354
- # browsers compatibility
164
+ b += db;
165
+ if (b > 16 || b < 0) db = -db;
166
+ setTimeout(nextAnim, 1);
167
+ };
168
+ setTimeout(nextAnim, 2000);
169
+ ```
355
170
 
356
- See https://leafletjs.com/ section 'Browser Support'
357
- In addition, if 'webp' as compression format is used see compatibility: https://caniuse.com/webp
171
+ ### more interactive - additional level and a bit of the red transparentness around the level made from current mouse position
172
+
173
+ ```ts
174
+ await wxsource.updateCurrentStyleObject({ levels: undefined }); // reset levels if existed in the style
175
+ const levels = wxsource.getCurrentStyleObjectCopy().levels || []; // get current/default/any levels
176
+ // generate a new color map from the levels
177
+ const colMap: [number, string][] = levels.map((level) => [level, '#' + Math.random().toString(16).slice(2, 8) + 'ff']);
178
+ let busy = false;
179
+ map.on('mousemove', async (e) => {
180
+ if (!wxsource || busy) return;
181
+ busy = true;
182
+ const tileInfo: WxTileInfo | undefined = wxsource.getLayerInfoAtLatLon(position(e), map);
183
+ if (tileInfo) {
184
+ await wxsource.updateCurrentStyleObject({ colorMap: [...colMap, [tileInfo.inStyleUnits[0], '#ff000000']] });
185
+ onsole.log(tileInfo);
186
+ }
187
+ busy = false;
188
+ });
189
+ ```
@@ -1,2 +1,2 @@
1
- import { ColorStylesStrict } from '../utils/wxtools';
2
- export declare const __colorStyles_default_preset: ColorStylesStrict;
1
+ import { WxColorStylesStrict } from '../utils/wxtools';
2
+ export declare const __colorStyles_default_preset: WxColorStylesStrict;
@@ -1,2 +1,2 @@
1
- import { Units } from '../utils/wxtools';
2
- export declare const __units_default_preset: Units;
1
+ import { WxUnits } from '../utils/wxtools';
2
+ export declare const __units_default_preset: WxUnits;
@@ -1,8 +1,35 @@
1
+ /**
2
+ * Main classes and interfaces to use in your application are:
3
+ * - {@link WxAPIOptions} options to pass to the constructor of {@link WxAPI}.
4
+ * - {@link WxAPI} the main class to use to interact with the *WxTiles* API and to create {@link WxDataSetManager} instances
5
+ * - {@link WxDataSetManager} class for managing WX datasets and create {@link WxTileSource}.
6
+ * * {@link FrameworkOptions} framework specific options to pass to the constructor of {@link WxTileSource}.
7
+ * - {@link WxLayerOptions} options to pass to the constructor of {@link WxTileSource}.
8
+ * - {@link WxTileSource} class for managing WX tiles sources.
9
+ * - {@link WxColorStyleWeak} interface for color styles.
10
+ * - {@link WxDate} type for dates.
11
+ * - {@link WxVars} type for variables.
12
+ * - {@link WxDatasetMeta} interface for dataset's meta data.
13
+ * - {@link WxVariableMeta} interface for variable's meta data.
14
+ * - {@link WxAllBoundariesMeta} interface for boundaries of a dataset.
15
+ * - {@link WxTileInfo} interface for tile's information.
16
+ *
17
+ * ### Note
18
+ * In case of use **async** member functions, you must use the **await** syntax.
19
+ * @module
20
+ */
1
21
  export { WxAPI } from './wxAPI/wxAPI';
2
- export type { WxAPIOptions, WxVariableMeta, WxVariablesMetas, WxBoundaryMeta, WxAllBoundariesMeta, WxDatasetMeta } from './wxAPI/wxAPI';
3
- export { WxDataSetManager } from './wxAPI/WxDataSetManager';
22
+ export type { WxAPIOptions, WxDatasetMeta, WxDatasetShortMeta, WxDataSetsMetasJSON, WxVariableMeta, WxVariablesMetas, WxBoundaryMeta, WxAllBoundariesMeta, } from './wxAPI/wxAPI';
23
+ export { WxDataSetManager, type WxDataSetManagerOptions } from './wxAPI/WxDataSetManager';
4
24
  export { WxTileSource } from './wxsource/wxsource';
5
- export type { WxLayerOptions, WxDate, WxRequestInit, WxTileInfo, WxVars, WxLngLat } from './wxlayer/wxlayer';
25
+ export { type FrameworkOptions, FrameworkParentClass } from './wxsource/wxsourcetypes';
26
+ export type { WxLayerOptions, WxDate, WxRequestInit, WxTileInfo, WxVars, WxLngLat, WxURIs } from './wxlayer/wxlayer';
27
+ export { WxLayer } from './wxlayer/wxlayer';
28
+ export type { WxLayerBaseAPI, WxLayerBaseImplementation, WxLayerAPI } from './wxlayer/WxImplementation';
6
29
  export { WxCreateLegend, type WxLegend, type WxTick } from './utils/RawCLUT';
7
30
  export { WxGetColorStyles, WxGetColorSchemes, WxTilesLogging, WXLOG } from './utils/wxtools';
8
- export type { XYZ, WxColorSchemes, WxColorStyleWeak, WxColorStyleStrict, WxTilesLibOptions } from './utils/wxtools';
31
+ export type { XYZ, WxUnits, WxUnitTuple, WxColorSchemes, WxColorStyleWeak, WxColorStyleStrict, WxColorStylesStrict, WxColorStylesWeakMixed, WxTilesLibOptions, ColorStylesIncomplete, Converter, IntegralPare, DataIntegral, DataIntegrals, DataPicture, DataPictures, UriLoaderPromiseFunc, } from './utils/wxtools';
32
+ export { Painter, WxRasterData } from './wxlayer/painter';
33
+ export { Loader, WxData, SLine, SLinePoint } from './wxlayer/loader';
34
+ export { type TileType, QTree, Tree, SubTrees, SubTreesN, TreeN } from './utils/qtree';
35
+ export { RawCLUT } from './utils/RawCLUT';