@metoceanapi/wxtiles-leaflet 2.3.0-0 → 2.4.0-1

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 (124) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +16 -3
  3. package/dep.dot +33 -0
  4. package/dep.svg +233 -0
  5. package/dist/es/customlayer/customlayer.d.ts +3 -0
  6. package/dist/es/index.d.ts +19 -13
  7. package/dist/es/index.js +6 -2
  8. package/dist/es/wxAPI/WxAPI.d.ts +3 -61
  9. package/dist/es/wxAPI/WxDataSetManager.d.ts +35 -123
  10. package/dist/es/wxsource/wxsource.d.ts +118 -51
  11. package/dist/es/wxsource/wxsourcetypes.d.ts +70 -10
  12. package/dist/web/index.js +6 -2
  13. package/docs/docs/assets/highlight.css +7 -0
  14. package/docs/docs/assets/search.js +1 -1
  15. package/docs/docs/classes/CustomWxTilesLayer.html +4 -1
  16. package/docs/docs/classes/DataIntegral.html +9 -9
  17. package/docs/docs/classes/QTree.html +41 -14
  18. package/docs/docs/classes/RawCLUT.html +9 -9
  19. package/docs/docs/classes/TilesCache.html +5 -5
  20. package/docs/docs/classes/WxAPI.html +109 -79
  21. package/docs/docs/classes/WxAPIControl.html +242 -0
  22. package/docs/docs/classes/WxDataSetManager.html +166 -118
  23. package/docs/docs/classes/WxInfoControl.html +172 -0
  24. package/docs/docs/classes/WxLegendControl.html +166 -0
  25. package/docs/docs/classes/WxStyleEditorControl.html +462 -0
  26. package/docs/docs/classes/WxTileSource.html +204 -108
  27. package/docs/docs/classes/WxTimeControl.html +219 -0
  28. package/docs/docs/enums/TileType.html +4 -4
  29. package/docs/docs/functions/WXLOG.html +10 -5
  30. package/docs/docs/functions/WxCreateLegend.html +14 -9
  31. package/docs/docs/functions/WxGetColorSchemes.html +10 -5
  32. package/docs/docs/functions/WxGetColorStyles.html +10 -5
  33. package/docs/docs/functions/WxTilesLogging.html +13 -5
  34. package/docs/docs/index.html +27 -7
  35. package/docs/docs/interfaces/CachedUriLoaderPromiseFunc.html +7 -5
  36. package/docs/docs/interfaces/ColorStylesIncomplete.html +10 -5
  37. package/docs/docs/interfaces/Converter.html +3 -5
  38. package/docs/docs/interfaces/DataPicture.html +5 -5
  39. package/docs/docs/interfaces/FrameworkOptions.html +12 -6
  40. package/docs/docs/interfaces/IntegralPare.html +3 -3
  41. package/docs/docs/interfaces/SLinePoint.html +4 -4
  42. package/docs/docs/interfaces/Tree.html +11 -7
  43. package/docs/docs/interfaces/WxAPIOptions.html +33 -24
  44. package/docs/docs/interfaces/WxAllBoundariesMeta.html +14 -9
  45. package/docs/docs/interfaces/WxAllDatasetsShortMetas.html +11 -6
  46. package/docs/docs/interfaces/WxBoundaryMeta.html +18 -10
  47. package/docs/docs/interfaces/WxColorSchemes.html +10 -5
  48. package/docs/docs/interfaces/WxColorStyleStrict.html +28 -28
  49. package/docs/docs/interfaces/WxColorStyleWeak.html +28 -28
  50. package/docs/docs/interfaces/WxColorStylesStrict.html +2 -2
  51. package/docs/docs/interfaces/WxColorStylesWeakMixed.html +10 -5
  52. package/docs/docs/interfaces/WxData.html +10 -6
  53. package/docs/docs/interfaces/WxDataSetManagerOptions.html +15 -15
  54. package/docs/docs/interfaces/WxDatasetMeta.html +20 -20
  55. package/docs/docs/interfaces/WxDatasetShortMeta.html +9 -8
  56. package/docs/docs/interfaces/WxLayerAPI.html +24 -28
  57. package/docs/docs/interfaces/WxLayerBaseAPI.html +18 -22
  58. package/docs/docs/interfaces/WxLayerOptions.html +18 -13
  59. package/docs/docs/interfaces/WxLegend.html +16 -15
  60. package/docs/docs/interfaces/WxLngLat.html +3 -3
  61. package/docs/docs/interfaces/WxRasterData.html +11 -8
  62. package/docs/docs/interfaces/WxRequestInit.html +2 -2
  63. package/docs/docs/interfaces/WxSourceLayerOptions.html +14 -12
  64. package/docs/docs/interfaces/WxTick.html +8 -7
  65. package/docs/docs/interfaces/WxTileInfo.html +10 -10
  66. package/docs/docs/interfaces/WxUnits.html +10 -5
  67. package/docs/docs/interfaces/WxVariableMeta.html +13 -12
  68. package/docs/docs/interfaces/WxVariablesMetas.html +11 -6
  69. package/docs/docs/interfaces/XYZ.html +4 -4
  70. package/docs/docs/modules.html +21 -8
  71. package/docs/docs/types/DataIntegrals.html +10 -5
  72. package/docs/docs/types/DataPictures.html +10 -5
  73. package/docs/docs/types/ListenerMethod.html +10 -5
  74. package/docs/docs/types/Loader.html +116 -0
  75. package/docs/docs/types/Painter.html +116 -0
  76. package/docs/docs/types/SLine.html +11 -6
  77. package/docs/docs/types/SubTrees.html +10 -5
  78. package/docs/docs/types/SubTreesN.html +12 -7
  79. package/docs/docs/types/TreeN.html +12 -7
  80. package/docs/docs/types/WxDate.html +10 -5
  81. package/docs/docs/types/WxEventType.html +10 -5
  82. package/docs/docs/types/WxInstances.html +13 -6
  83. package/docs/docs/types/WxLayer.html +116 -0
  84. package/docs/docs/types/WxLayerVarsNames.html +11 -6
  85. package/docs/docs/types/WxURIs.html +10 -5
  86. package/docs/docs/types/WxUnitTuple.html +10 -5
  87. package/docs/docs/variables/WxLayerBaseImplementation.html +116 -0
  88. package/docs/script/script.css +1 -1
  89. package/docs/script/script.js +8 -8
  90. package/hooks/pre-commit +29 -0
  91. package/package.json +9 -2
  92. package/src_example/frwrkdeps.ts +57 -18
  93. package/src_example/index.ts +2 -2
  94. package/src_example/start.ts +100 -46
  95. package/watch-public.mjs +16 -12
  96. package/dist/es/controls/WxAPIControl.d.ts +0 -19
  97. package/dist/es/controls/WxInfoControl.d.ts +0 -16
  98. package/dist/es/controls/WxLegendControl.d.ts +0 -14
  99. package/dist/es/controls/WxStyleEditorControl.d.ts +0 -52
  100. package/dist/es/controls/WxTimeControl .d.ts +0 -18
  101. package/dist/es/defaults/colorschemes.d.ts +0 -2
  102. package/dist/es/defaults/styles.d.ts +0 -2
  103. package/dist/es/defaults/uconv.d.ts +0 -2
  104. package/dist/es/utils/RawCLUT.d.ts +0 -57
  105. package/dist/es/utils/mercator.d.ts +0 -4
  106. package/dist/es/utils/qtree.d.ts +0 -27
  107. package/dist/es/utils/tests_wxtools.d.ts +0 -1
  108. package/dist/es/utils/wxtools.d.ts +0 -361
  109. package/dist/es/wxAPI/WxAPItypes.d.ts +0 -152
  110. package/dist/es/wxlayer/WxImplementation.d.ts +0 -189
  111. package/dist/es/wxlayer/loader.d.ts +0 -54
  112. package/dist/es/wxlayer/loadertools.d.ts +0 -50
  113. package/dist/es/wxlayer/painter.d.ts +0 -58
  114. package/dist/es/wxlayer/wxlayer.d.ts +0 -186
  115. package/docs/docs/classes/Loader.html +0 -165
  116. package/docs/docs/classes/Painter.html +0 -161
  117. package/docs/docs/classes/WxLayer.html +0 -419
  118. package/docs/docs/classes/WxLayerBaseImplementation.html +0 -427
  119. package/docs/examples/interactive.html +0 -84
  120. package/docs/examples/res/icon.png +0 -0
  121. package/docs/examples/res/wxtiles-logo.png +0 -0
  122. package/docs/examples/seaMaskAndAnimatedBlur.html +0 -76
  123. package/docs/examples/simpleDemo.html +0 -70
  124. package/docs/server.py +0 -11
@@ -1,84 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>WxTiles v3.0</title>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <link rel="shortcut icon" href="res/icon.png" type="image/x-icon" />
8
-
9
- <!-- LEAFLET lib goes first -->
10
- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" crossorigin="" />
11
- <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" crossorigin=""></script>
12
-
13
- <!-- WxTile lib goes here -->
14
- <script src="https://unpkg.com/@metoceanapi/wxtiles-leaflet@2.1.3/dist/web/index.js"></script>
15
- <link rel="stylesheet" href="https://unpkg.com/@metoceanapi/wxtiles-leaflet@2.1.3/dist/web/index.css" />
16
- </head>
17
-
18
- <body style="margin: 0">
19
- <div id="map" style="height: 100vh; width: 100vw"></div>
20
- <script>
21
- ('use strict');
22
- start();
23
- async function start() {
24
- //// Leaflet initialization START
25
- const map = L.map('map', { center: [0, 0], zoom: 2, zoomControl: true });
26
- // add navigation controls
27
- L.control.zoom({ position: 'bottomright' }).addTo(map);
28
- //// Leaflet initialization END
29
-
30
- //// Helper
31
- const addWxLayer = async (wxsource) => {
32
- map.addLayer(wxsource);
33
- await new Promise((done) => wxsource.once('load', done)); // highly recommended to await for the first load
34
- };
35
-
36
- const getCoords = (e) => e.latlng.wrap();
37
- //// Helpers END
38
-
39
- //// WXTILES START
40
- // grab the WxTiles API
41
- const { WxTilesLogging, WxAPI } = window.wxtilesleaflet;
42
-
43
- WxTilesLogging(true); // log WxTiles info to console if needed
44
-
45
- const dataServerURL = 'https://tiles.metoceanapi.com/data/';
46
- // Get the API ready - should be ONE per application
47
- const wxapi = new WxAPI({ dataServerURL, maskURL: 'auto', qtreeURL: 'auto' });
48
-
49
- // Define the dataset and variable
50
- const datasetName = 'gfs.global';
51
- const variable = 'air.temperature.at-2m'; // Scalar example
52
- // const variable = 'wind.speed.eastward.at-10m'; // Vector example
53
-
54
- // Create a dataset manager (may be used for many layers from this dataset)
55
- const wxdatasetManager = await wxapi.createDatasetManager(datasetName);
56
-
57
- // create a layer
58
- const layerFrameworkOptions = { id: 'wxsource', opacity: 1, attribution: 'WxTiles' };
59
- const wxsource = wxdatasetManager.createSourceLayer({ variable }, layerFrameworkOptions);
60
-
61
- // add the layer to the map
62
- await addWxLayer(wxsource);
63
-
64
- // extra magic
65
- // on mouse movement, add a new color to the color map and re-render the layer
66
- await wxsource.updateCurrentStyleObject({ levels: undefined, mask: 'land' }); // reset levels if existing in the style
67
-
68
- const levels = wxsource.getCurrentStyleObjectCopy().levels || []; // get current/default/any levels
69
- // generate a new color map from the existing levels
70
- const colMap = levels.map((level) => [level, '#' + Math.random().toString(16).slice(2, 8) + 'ff']);
71
- let busy = false;
72
- map.on('mousemove', async (e) => {
73
- if (!wxsource || busy) return;
74
- busy = true;
75
- const tileInfo = wxsource.getLayerInfoAtLatLon(getCoords(e), map);
76
- if (tileInfo) {
77
- await wxsource.updateCurrentStyleObject({ colorMap: [...colMap, [tileInfo.inStyleUnits[0], '#ff000000']] });
78
- }
79
- busy = false;
80
- });
81
- }
82
- </script>
83
- </body>
84
- </html>
Binary file
Binary file
@@ -1,76 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>WxTiles v3.0</title>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <link rel="shortcut icon" href="res/icon.png" type="image/x-icon" />
8
-
9
- <!-- LEAFLET lib goes first -->
10
- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" crossorigin="" />
11
- <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" crossorigin=""></script>
12
-
13
- <!-- WxTile lib goes here -->
14
- <script src="https://unpkg.com/@metoceanapi/wxtiles-leaflet@2.1.3/dist/web/index.js"></script>
15
- <link rel="stylesheet" href="https://unpkg.com/@metoceanapi/wxtiles-leaflet@2.1.3/dist/web/index.css" />
16
- </head>
17
-
18
- <body style="margin: 0">
19
- <div id="map" style="height: 100vh; width: 100vw"></div>
20
-
21
- <script>
22
- ('use strict');
23
- start();
24
- async function start() {
25
- //// Leaflet initialization START
26
- const map = L.map('map', { center: [0, 0], zoom: 2, zoomControl: true });
27
- // add navigation controls
28
- L.control.zoom({ position: 'bottomright' }).addTo(map);
29
- //// Leaflet initialization END
30
-
31
- //// Helper
32
- const addWxLayer = async (wxsource) => {
33
- map.addLayer(wxsource);
34
- await new Promise((done) => wxsource.once('load', done)); // highly recommended to await for the first load
35
- };
36
-
37
- const getCoords = (e) => e.latlng.wrap();
38
- //// Helpers END
39
-
40
- //// WXTILES START
41
- // grab the WxTiles API
42
- const { WxTilesLogging, WxAPI } = window.wxtilesleaflet;
43
-
44
- WxTilesLogging(true); // log WxTiles info to console if needed
45
-
46
- const dataServerURL = 'https://tiles.metoceanapi.com/data/';
47
- // Get the API ready - should be ONE per application
48
- const wxapi = new WxAPI({ dataServerURL, maskURL: 'auto', qtreeURL: 'auto' });
49
-
50
- // Define the dataset and variable
51
- const datasetName = 'gfs.global';
52
- const variable = 'air.temperature.at-2m'; // Scalar example
53
- // const variable = 'wind.speed.eastward.at-10m'; // Vector example
54
-
55
- // Create a dataset manager (may be used for many layers from this dataset)
56
- const wxdatasetManager = await wxapi.createDatasetManager(datasetName);
57
-
58
- // create a layer
59
- const layerFrameworkOptions = { id: 'wxsource', opacity: 1, attribution: 'WxTiles' };
60
- const wxsource = wxdatasetManager.createSourceLayer({ variable }, layerFrameworkOptions);
61
-
62
- // add the layer to the map
63
- await addWxLayer(wxsource);
64
-
65
- // extra magic
66
- // update the style: mask sea
67
- await wxsource.updateCurrentStyleObject({ mask: 'land' });
68
- // start the blur animation
69
- (async function step(n = 0) {
70
- await wxsource.updateCurrentStyleObject({ isolineText: false, blurRadius: ~~(10 * Math.sin(n / 500) + 10) });
71
- requestAnimationFrame(step);
72
- })();
73
- }
74
- </script>
75
- </body>
76
- </html>
@@ -1,70 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>WxTiles v3.0</title>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <link rel="shortcut icon" href="res/icon.png" type="image/x-icon" />
8
-
9
- <!-- LEAFLET lib goes first -->
10
- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" crossorigin="" />
11
- <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" crossorigin=""></script>
12
-
13
- <!-- WxTile lib goes here -->
14
- <script src="https://unpkg.com/@metoceanapi/wxtiles-leaflet@2.1.3/dist/web/index.js"></script>
15
- <link rel="stylesheet" href="https://unpkg.com/@metoceanapi/wxtiles-leaflet@2.1.3/dist/web/index.css" />
16
- </head>
17
-
18
- <body style="margin: 0">
19
- <div id="map" style="height: 100vh; width: 100vw"></div>
20
-
21
- <script>
22
- ('use strict');
23
- start();
24
- async function start() {
25
- //// Leaflet initialization START
26
- const map = L.map('map', { center: [0, 0], zoom: 2, zoomControl: true });
27
- // add navigation controls
28
- L.control.zoom({ position: 'bottomright' }).addTo(map);
29
- //// Leaflet initialization END
30
-
31
- //// Helper
32
- const addWxLayer = async (wxsource) => {
33
- map.addLayer(wxsource);
34
- await new Promise((done) => wxsource.once('load', done)); // highly recommended to await for the first load
35
- };
36
-
37
- const getCoords = (e) => e.latlng.wrap();
38
- //// Helpers END
39
-
40
- //// WXTILES START
41
- // grab the WxTiles API
42
- const { WxTilesLogging, WxAPI } = window.wxtilesleaflet;
43
-
44
- WxTilesLogging(true); // log WxTiles info to console if needed
45
-
46
- const dataServerURL = 'https://tiles.metoceanapi.com/data/';
47
- // Get the API ready - should be ONE per application
48
- const wxapi = new WxAPI({ dataServerURL, maskURL: 'auto', qtreeURL: 'auto' });
49
-
50
- // Define the dataset and variable
51
- const datasetName = 'gfs.global';
52
- // const variable = 'air.temperature.at-2m'; // Scalar example
53
- const variable = 'wind.speed.eastward.at-10m'; // Vector example
54
-
55
- // Create a dataset manager (may be used for many layers from this dataset)
56
- const wxdatasetManager = await wxapi.createDatasetManager(datasetName);
57
-
58
- // create a layer
59
- const layerFrameworkOptions = { id: 'wxsource', opacity: 1, attribution: 'WxTiles' };
60
- const wxsource = wxdatasetManager.createSourceLayer({ variable }, layerFrameworkOptions);
61
-
62
- // add the layer to the map
63
- await addWxLayer(wxsource);
64
-
65
- // extra magic
66
- await wxsource.updateCurrentStyleObject({ streamLineColor: 'inverted' });
67
- }
68
- </script>
69
- </body>
70
- </html>
package/docs/server.py DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env python3
2
- from http.server import HTTPServer, SimpleHTTPRequestHandler, test
3
- import sys
4
-
5
- class CORSRequestHandler (SimpleHTTPRequestHandler):
6
- def end_headers (self):
7
- self.send_header('Access-Control-Allow-Origin', '*')
8
- SimpleHTTPRequestHandler.end_headers(self)
9
-
10
- if __name__ == '__main__':
11
- test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)