gridviz 3.0.35 → 3.0.36

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 (67) hide show
  1. package/README.md +129 -129
  2. package/dist/gridviz.js +17486 -17486
  3. package/dist/gridviz.min.js +2 -2
  4. package/package.json +73 -73
  5. package/src/button/Button.js +67 -67
  6. package/src/button/FullscreenButton.js +121 -121
  7. package/src/button/ZoomButtons.js +103 -103
  8. package/src/core/Dataset.js +154 -154
  9. package/src/core/Drawable.js +78 -78
  10. package/src/core/GeoCanvas.js +443 -443
  11. package/src/core/Layer.js +23 -23
  12. package/src/core/Legend.js +108 -108
  13. package/src/core/Map.js +568 -568
  14. package/src/core/MultiResolutionDataset.js +93 -93
  15. package/src/core/Style.js +98 -98
  16. package/src/core/Tooltip.js +182 -182
  17. package/src/dataset/COGeo.js +25 -25
  18. package/src/dataset/CSVGrid.js +112 -112
  19. package/src/dataset/GeoTIFF.js +122 -122
  20. package/src/dataset/JSGrid.js +55 -55
  21. package/src/dataset/TiledGrid.js +302 -302
  22. package/src/dataset/worker.js +18 -18
  23. package/src/index.js +79 -79
  24. package/src/layer/BackgroundLayer.js +173 -173
  25. package/src/layer/BackgroundLayerImage.js +81 -81
  26. package/src/layer/BackgroundLayerWMS.js +104 -104
  27. package/src/layer/GeoJSONLayer.js +276 -276
  28. package/src/layer/GridLayer.js +166 -166
  29. package/src/layer/LabelLayer.js +194 -194
  30. package/src/legend/ColorCategoryLegend.js +109 -109
  31. package/src/legend/ColorDiscreteLegend.js +100 -100
  32. package/src/legend/ColorLegend.js +115 -115
  33. package/src/legend/OrientationLegend.js +89 -89
  34. package/src/legend/SizeLegend.js +224 -224
  35. package/src/legend/TernaryLegend.js +302 -302
  36. package/src/style/CompositionStyle.js +291 -291
  37. package/src/style/DotDensityStyle.js +133 -133
  38. package/src/style/ImageStyle.js +100 -100
  39. package/src/style/Interpolator.js +258 -258
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +180 -180
  42. package/src/style/LegoStyle.js +132 -132
  43. package/src/style/MosaicStyle.js +99 -99
  44. package/src/style/NinjaStarStyle.js +102 -102
  45. package/src/style/PillarStyle.js +207 -207
  46. package/src/style/SegmentStyle.js +105 -105
  47. package/src/style/ShadingRayStyle.js +280 -280
  48. package/src/style/ShadingStyle.js +72 -72
  49. package/src/style/ShapeColorSizeStyle.js +147 -147
  50. package/src/style/SideCategoryStyle.js +112 -112
  51. package/src/style/SideStyle.js +217 -217
  52. package/src/style/SideTanakaStyle.js +154 -154
  53. package/src/style/SquareColorCategoryWebGLStyle.js +307 -294
  54. package/src/style/SquareColorWebGLStyle.js +126 -126
  55. package/src/style/StrokeStyle.js +135 -135
  56. package/src/style/TextStyle.js +110 -110
  57. package/src/style/TimeSeriesStyle.js +222 -222
  58. package/src/utils/WebGLRectangleColoring.js +106 -106
  59. package/src/utils/WebGLSquareColoring.js +118 -118
  60. package/src/utils/WebGLSquareColoringAdvanced.js +227 -227
  61. package/src/utils/WebGLSquareColoringKS.js +153 -153
  62. package/src/utils/scale.js +255 -255
  63. package/src/utils/stretching.js +120 -120
  64. package/src/utils/ternary.js +208 -208
  65. package/src/utils/utils.js +125 -125
  66. package/src/utils/webGLUtils.js +73 -73
  67. package/src/utils/zoomUtils.js +142 -142
@@ -1,122 +1,122 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- import { Dataset } from '../core/Dataset.js'
5
- //import { fromUrl } from "geotiff"
6
-
7
- /**
8
- * @todo
9
- * A dataset composed of a single GeoTiff file.
10
- *
11
- * @module dataset
12
- * @author Joseph Davies, Julien Gaffuri
13
- */
14
- export class GeoTIFF extends Dataset {
15
- constructor(map, url, resolution, opts = {}) {
16
- super(map, url, resolution, opts)
17
-
18
- /**
19
- * @private
20
- * @type {Array.<import("../core/Dataset").Cell>} */
21
- this.cells = []
22
-
23
- /**
24
- * @type {string}
25
- * @private */
26
- this.infoLoadingStatus = 'notLoaded'
27
- }
28
-
29
- /**
30
- * Request data within a geographic envelope.
31
- *
32
- * @param {import("../core/GeoCanvas.js").Envelope|undefined} e
33
- */
34
- getData(e) {
35
- //check if data already loaded
36
- if (this.infoLoadingStatus != 'notLoaded') return this
37
-
38
- //load data
39
- this.infoLoadingStatus = 'loading'
40
-
41
- /*
42
-
43
- fromUrl(this.url)
44
- .then(tiff => {
45
- console.log(tiff);
46
-
47
- (async function () {
48
- const image = await tiff.getImage();
49
- const width = image.getWidth();
50
- const height = image.getHeight();
51
- const tileWidth = image.getTileWidth();
52
- const tileHeight = image.getTileHeight();
53
- const samplesPerPixel = image.getSamplesPerPixel();
54
-
55
- //for geotiff
56
- const origin = image.getOrigin();
57
- const resolution = image.getResolution();
58
- const bbox = image.getBoundingBox();
59
-
60
- console.log(image)
61
- console.log(width, height)
62
- console.log(tileWidth, tileHeight)
63
- console.log(samplesPerPixel)
64
- console.log(origin)
65
- console.log(resolution)
66
- console.log(bbox)
67
-
68
- console.log("-------")
69
-
70
- const data = await image.readRasters();
71
- console.log(data)
72
-
73
- })()
74
-
75
- //convert coordinates in numbers
76
- //for (const c of data) { c.x = +c.x; c.y = +c.y; }
77
-
78
- //this.cells = data;
79
-
80
- //execute preprocess, if any
81
- //if (this.preprocess) for (const c of this.cells) this.preprocess(c);
82
-
83
- //TODO check if redraw is necessary
84
- //that is if the dataset belongs to a layer which is visible at the current zoom level
85
-
86
- //execute the callback, usually a draw function
87
- if (redraw) redraw()
88
-
89
- this.infoLoadingStatus = "loaded";
90
-
91
-
92
- })
93
- .catch(() => {
94
- //mark as failed
95
- this.infoLoadingStatus = "failed";
96
- this.cells = []
97
- });
98
- */
99
-
100
- return this
101
- }
102
-
103
- /**
104
- * Fill the view cache with all cells which are within a geographical envelope.
105
- *
106
- * @param {import("../core/GeoCanvas.js").Envelope} extGeo
107
- * @returns {void}
108
- */
109
- updateViewCache(extGeo) {
110
- //data not loaded yet
111
- if (!this.cells) return
112
-
113
- this.cellsViewCache = []
114
- for (const cell of this.cells) {
115
- if (+cell.x + this.resolution < extGeo.xMin) continue
116
- if (+cell.x - this.resolution > extGeo.xMax) continue
117
- if (+cell.y + this.resolution < extGeo.yMin) continue
118
- if (+cell.y - this.resolution > extGeo.yMax) continue
119
- this.cellsViewCache.push(cell)
120
- }
121
- }
122
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ import { Dataset } from '../core/Dataset.js'
5
+ //import { fromUrl } from "geotiff"
6
+
7
+ /**
8
+ * @todo
9
+ * A dataset composed of a single GeoTiff file.
10
+ *
11
+ * @module dataset
12
+ * @author Joseph Davies, Julien Gaffuri
13
+ */
14
+ export class GeoTIFF extends Dataset {
15
+ constructor(map, url, resolution, opts = {}) {
16
+ super(map, url, resolution, opts)
17
+
18
+ /**
19
+ * @private
20
+ * @type {Array.<import("../core/Dataset").Cell>} */
21
+ this.cells = []
22
+
23
+ /**
24
+ * @type {string}
25
+ * @private */
26
+ this.infoLoadingStatus = 'notLoaded'
27
+ }
28
+
29
+ /**
30
+ * Request data within a geographic envelope.
31
+ *
32
+ * @param {import("../core/GeoCanvas.js").Envelope|undefined} e
33
+ */
34
+ getData(e) {
35
+ //check if data already loaded
36
+ if (this.infoLoadingStatus != 'notLoaded') return this
37
+
38
+ //load data
39
+ this.infoLoadingStatus = 'loading'
40
+
41
+ /*
42
+
43
+ fromUrl(this.url)
44
+ .then(tiff => {
45
+ console.log(tiff);
46
+
47
+ (async function () {
48
+ const image = await tiff.getImage();
49
+ const width = image.getWidth();
50
+ const height = image.getHeight();
51
+ const tileWidth = image.getTileWidth();
52
+ const tileHeight = image.getTileHeight();
53
+ const samplesPerPixel = image.getSamplesPerPixel();
54
+
55
+ //for geotiff
56
+ const origin = image.getOrigin();
57
+ const resolution = image.getResolution();
58
+ const bbox = image.getBoundingBox();
59
+
60
+ console.log(image)
61
+ console.log(width, height)
62
+ console.log(tileWidth, tileHeight)
63
+ console.log(samplesPerPixel)
64
+ console.log(origin)
65
+ console.log(resolution)
66
+ console.log(bbox)
67
+
68
+ console.log("-------")
69
+
70
+ const data = await image.readRasters();
71
+ console.log(data)
72
+
73
+ })()
74
+
75
+ //convert coordinates in numbers
76
+ //for (const c of data) { c.x = +c.x; c.y = +c.y; }
77
+
78
+ //this.cells = data;
79
+
80
+ //execute preprocess, if any
81
+ //if (this.preprocess) for (const c of this.cells) this.preprocess(c);
82
+
83
+ //TODO check if redraw is necessary
84
+ //that is if the dataset belongs to a layer which is visible at the current zoom level
85
+
86
+ //execute the callback, usually a draw function
87
+ if (redraw) redraw()
88
+
89
+ this.infoLoadingStatus = "loaded";
90
+
91
+
92
+ })
93
+ .catch(() => {
94
+ //mark as failed
95
+ this.infoLoadingStatus = "failed";
96
+ this.cells = []
97
+ });
98
+ */
99
+
100
+ return this
101
+ }
102
+
103
+ /**
104
+ * Fill the view cache with all cells which are within a geographical envelope.
105
+ *
106
+ * @param {import("../core/GeoCanvas.js").Envelope} extGeo
107
+ * @returns {void}
108
+ */
109
+ updateViewCache(extGeo) {
110
+ //data not loaded yet
111
+ if (!this.cells) return
112
+
113
+ this.cellsViewCache = []
114
+ for (const cell of this.cells) {
115
+ if (+cell.x + this.resolution < extGeo.xMin) continue
116
+ if (+cell.x - this.resolution > extGeo.xMax) continue
117
+ if (+cell.y + this.resolution < extGeo.yMin) continue
118
+ if (+cell.y - this.resolution > extGeo.yMax) continue
119
+ this.cellsViewCache.push(cell)
120
+ }
121
+ }
122
+ }
@@ -1,55 +1,55 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- import { Dataset } from '../core/Dataset.js'
5
-
6
- /**
7
- * A dataset composed of cells defined in javascript, or loaded outside of gridviz map.
8
- *
9
- * @module dataset
10
- * @author Joseph Davies, Julien Gaffuri
11
- */
12
- export class JSGrid extends Dataset {
13
- /**
14
- * @param {number} resolution The dataset resolution in geographical unit.
15
- * @param {Array.<Object>} cells The cells.
16
- * @param {} opts
17
- */
18
- constructor(resolution, cells, opts = {}) {
19
- super(undefined, '', resolution, opts)
20
-
21
- /**
22
- * @private
23
- * @type {Array.<import('../core/Dataset.js').Cell>} */
24
- this.cells = cells || []
25
- }
26
-
27
- /**
28
- * Request data within a geographic envelope.
29
- *
30
- * @param {import("../core/GeoCanvas.js").Envelope|undefined} e
31
- */
32
- getData(e) {
33
- return this
34
- }
35
-
36
- /**
37
- * Fill the view cache with all cells which are within a geographical envelope.
38
- *
39
- * @param {import("../core/GeoCanvas.js").Envelope} extGeo
40
- * @returns {void}
41
- */
42
- updateViewCache(extGeo) {
43
- //data not loaded yet
44
- if (!this.cells) return
45
-
46
- this.cellsViewCache = []
47
- for (const cell of this.cells) {
48
- if (+cell.x + this.resolution < extGeo.xMin) continue
49
- if (+cell.x - this.resolution > extGeo.xMax) continue
50
- if (+cell.y + this.resolution < extGeo.yMin) continue
51
- if (+cell.y - this.resolution > extGeo.yMax) continue
52
- this.cellsViewCache.push(cell)
53
- }
54
- }
55
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ import { Dataset } from '../core/Dataset.js'
5
+
6
+ /**
7
+ * A dataset composed of cells defined in javascript, or loaded outside of gridviz map.
8
+ *
9
+ * @module dataset
10
+ * @author Joseph Davies, Julien Gaffuri
11
+ */
12
+ export class JSGrid extends Dataset {
13
+ /**
14
+ * @param {number} resolution The dataset resolution in geographical unit.
15
+ * @param {Array.<Object>} cells The cells.
16
+ * @param {} opts
17
+ */
18
+ constructor(resolution, cells, opts = {}) {
19
+ super(undefined, '', resolution, opts)
20
+
21
+ /**
22
+ * @private
23
+ * @type {Array.<import('../core/Dataset.js').Cell>} */
24
+ this.cells = cells || []
25
+ }
26
+
27
+ /**
28
+ * Request data within a geographic envelope.
29
+ *
30
+ * @param {import("../core/GeoCanvas.js").Envelope|undefined} e
31
+ */
32
+ getData(e) {
33
+ return this
34
+ }
35
+
36
+ /**
37
+ * Fill the view cache with all cells which are within a geographical envelope.
38
+ *
39
+ * @param {import("../core/GeoCanvas.js").Envelope} extGeo
40
+ * @returns {void}
41
+ */
42
+ updateViewCache(extGeo) {
43
+ //data not loaded yet
44
+ if (!this.cells) return
45
+
46
+ this.cellsViewCache = []
47
+ for (const cell of this.cells) {
48
+ if (+cell.x + this.resolution < extGeo.xMin) continue
49
+ if (+cell.x - this.resolution > extGeo.xMax) continue
50
+ if (+cell.y + this.resolution < extGeo.yMin) continue
51
+ if (+cell.y - this.resolution > extGeo.yMax) continue
52
+ this.cellsViewCache.push(cell)
53
+ }
54
+ }
55
+ }