gridviz 3.0.19 → 3.0.20

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 (55) hide show
  1. package/README.md +128 -128
  2. package/dist/gridviz.js +7861 -7861
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +74 -74
  5. package/src/button/ZoomButtons.js +101 -101
  6. package/src/core/Dataset.js +154 -154
  7. package/src/core/Drawable.js +60 -60
  8. package/src/core/GeoCanvas.js +430 -430
  9. package/src/core/Layer.js +23 -23
  10. package/src/core/Legend.js +108 -108
  11. package/src/core/Map.js +516 -516
  12. package/src/core/MultiResolutionDataset.js +93 -93
  13. package/src/core/Style.js +98 -98
  14. package/src/dataset/CSVGrid.js +112 -112
  15. package/src/dataset/GeoTIFF.js +122 -122
  16. package/src/dataset/JSGrid.js +55 -55
  17. package/src/dataset/TiledGrid.js +302 -302
  18. package/src/dataset/worker.js +18 -18
  19. package/src/index.js +77 -77
  20. package/src/layer/BackgroundLayer.js +162 -162
  21. package/src/layer/BackgroundLayerImage.js +81 -81
  22. package/src/layer/BackgroundLayerWMS.js +104 -104
  23. package/src/layer/GeoJSONLayer.js +214 -214
  24. package/src/layer/GridLayer.js +148 -148
  25. package/src/layer/LabelLayer.js +194 -194
  26. package/src/legend/ColorCategoryLegend.js +109 -109
  27. package/src/legend/ColorDiscreteLegend.js +100 -100
  28. package/src/legend/ColorLegend.js +115 -115
  29. package/src/legend/OrientationLegend.js +89 -89
  30. package/src/legend/SizeLegend.js +224 -224
  31. package/src/legend/TernaryLegend.js +302 -302
  32. package/src/style/CompositionStyle.js +291 -291
  33. package/src/style/DotDensityStyle.js +133 -133
  34. package/src/style/ImageStyle.js +100 -100
  35. package/src/style/IsoFenceStyle.js +217 -217
  36. package/src/style/JoyPlotStyle.js +127 -127
  37. package/src/style/LegoStyle.js +110 -110
  38. package/src/style/MosaicStyle.js +99 -99
  39. package/src/style/NinjaStarStyle.js +102 -102
  40. package/src/style/PillarStyle.js +207 -207
  41. package/src/style/SegmentStyle.js +105 -105
  42. package/src/style/ShapeColorSizeStyle.js +147 -147
  43. package/src/style/SideCategoryStyle.js +112 -112
  44. package/src/style/SideStyle.js +212 -212
  45. package/src/style/SquareColorCategoryWebGLStyle.js +107 -107
  46. package/src/style/SquareColorWebGLStyle.js +126 -126
  47. package/src/style/StrokeStyle.js +135 -135
  48. package/src/style/TanakaStyle.js +69 -69
  49. package/src/style/TextStyle.js +110 -110
  50. package/src/style/TimeSeriesStyle.js +222 -222
  51. package/src/utils/scale.js +218 -218
  52. package/src/utils/stretching.js +120 -120
  53. package/src/utils/ternary.js +208 -208
  54. package/src/utils/utils.js +58 -58
  55. package/src/utils/webGLUtils.js +72 -72
@@ -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
+ }