gridviz 2.0.39 → 2.0.41
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.
- package/dist/gridviz.js +6102 -24576
- package/dist/gridviz.min.js +1 -1
- package/package.json +2 -4
- package/src/App.js +0 -56
- package/src/DatasetComponent.js +0 -2
- package/src/dataset/TiledGrid.js +59 -91
- package/src/index.js +3 -4
- package/src/style/TextStyle.js +4 -4
- package/src/dataset/ParquetGrid.js +0 -122
- package/src/style/KernelSmoothingOldStyle.js +0 -221
- package/src/style/KernelSmoothingStyle.js +0 -115
- package/src/style/KernelSmoothingWGLStyle.js +0 -130
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gridviz",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.41",
|
|
4
4
|
"description": "Visualization tool for gridded statistics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"statistics",
|
|
@@ -47,15 +47,13 @@
|
|
|
47
47
|
"src/**/*.js"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"apache-arrow": "^10.0.1",
|
|
51
50
|
"d3-color": "^3.1.0",
|
|
52
51
|
"d3-fetch": "^3.0.1",
|
|
53
52
|
"d3-format": "^3.1.0",
|
|
54
53
|
"d3-geo": "^3.0.1",
|
|
55
54
|
"d3-random": "^3.0.1",
|
|
56
55
|
"d3-selection": "^3.0.0",
|
|
57
|
-
"d3-zoom": "^3.0.0"
|
|
58
|
-
"fast-kde": "^0.2.1"
|
|
56
|
+
"d3-zoom": "^3.0.0"
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
59
|
"@babel/core": "^7.9.0",
|
package/src/App.js
CHANGED
|
@@ -7,7 +7,6 @@ import { Layer } from './Layer.js'
|
|
|
7
7
|
import { Dataset } from './Dataset.js'
|
|
8
8
|
import { Tooltip } from './Tooltip.js'
|
|
9
9
|
import { CSVGrid } from './dataset/CSVGrid.js'
|
|
10
|
-
//import { ParquetGrid } from './dataset/ParquetGrid';
|
|
11
10
|
import { TiledGrid } from './dataset/TiledGrid.js'
|
|
12
11
|
import { BackgroundLayer } from './BackgroundLayer.js'
|
|
13
12
|
import { BackgroundLayerWMS } from './BackgroundLayerWMS.js'
|
|
@@ -450,18 +449,6 @@ export class App {
|
|
|
450
449
|
)
|
|
451
450
|
}
|
|
452
451
|
|
|
453
|
-
/**
|
|
454
|
-
* Make a parquet grid dataset.
|
|
455
|
-
*
|
|
456
|
-
* @param {string} url The URL of the dataset.
|
|
457
|
-
* @param {number} resolution The dataset resolution in geographical unit.
|
|
458
|
-
* @param {object=} opts The parameters of the dataset.
|
|
459
|
-
* @returns {Dataset}
|
|
460
|
-
*/
|
|
461
|
-
/*makeParquetGridDataset(url, resolution, opts) {
|
|
462
|
-
return new Dataset([new ParquetGrid(url, resolution, opts).getData(undefined, () => { this.cg.redraw(); })], [], opts)
|
|
463
|
-
}*/
|
|
464
|
-
|
|
465
452
|
/**
|
|
466
453
|
* Make a tiled grid dataset.
|
|
467
454
|
*
|
|
@@ -483,22 +470,6 @@ export class App {
|
|
|
483
470
|
|
|
484
471
|
//multi scale dataset creation
|
|
485
472
|
|
|
486
|
-
/**
|
|
487
|
-
* Make a multi scale parquet grid dataset.
|
|
488
|
-
*
|
|
489
|
-
* @param {Array.<number>} resolutions
|
|
490
|
-
* @param {function(number):string} resToURL
|
|
491
|
-
* @param {{preprocess?:function(import('./Dataset').Cell):boolean}} opts
|
|
492
|
-
* @returns {Dataset}
|
|
493
|
-
*/
|
|
494
|
-
/*makeMultiScaleParquetGridDataset(resolutions, resToURL, opts) {
|
|
495
|
-
return Dataset.make(
|
|
496
|
-
resolutions,
|
|
497
|
-
(res) => new ParquetGrid(resToURL(res), res, opts).getData(undefined, () => { this.cg.redraw(); }),
|
|
498
|
-
opts
|
|
499
|
-
)
|
|
500
|
-
}*/
|
|
501
|
-
|
|
502
473
|
/**
|
|
503
474
|
* Make a multi scale CSV grid dataset.
|
|
504
475
|
*
|
|
@@ -555,19 +526,6 @@ export class App {
|
|
|
555
526
|
return this.addLayerFromDataset(ds, styles, opts)
|
|
556
527
|
}
|
|
557
528
|
|
|
558
|
-
/**
|
|
559
|
-
* Add a layer from a parquet grid dataset.
|
|
560
|
-
*
|
|
561
|
-
* @param {string} url The URL of the dataset.
|
|
562
|
-
* @param {number} resolution The dataset resolution in geographical unit.
|
|
563
|
-
* @param {Array.<import('./Style').Style>} styles The styles, ordered in drawing order.
|
|
564
|
-
* @param {object=} opts The parameters of the dataset and layer.
|
|
565
|
-
* @returns {this}
|
|
566
|
-
*/
|
|
567
|
-
/*addParquetGridLayer(url, resolution, styles, opts) {
|
|
568
|
-
const ds = this.makeParquetGridDataset(url, resolution, opts)
|
|
569
|
-
return this.addLayerFromDataset(ds, styles, opts);
|
|
570
|
-
}*/
|
|
571
529
|
|
|
572
530
|
/**
|
|
573
531
|
*
|
|
@@ -595,20 +553,6 @@ export class App {
|
|
|
595
553
|
return this.addLayerFromDataset(ds, styles, opts)
|
|
596
554
|
}
|
|
597
555
|
|
|
598
|
-
/**
|
|
599
|
-
* Add a layer from a parquet grid dataset.
|
|
600
|
-
*
|
|
601
|
-
* @param {Array.<number>} resolutions
|
|
602
|
-
* @param {function(number):string} resToURL
|
|
603
|
-
* @param {Array.<import('./Style').Style>} styles The styles, ordered in drawing order.
|
|
604
|
-
* @param {object=} opts The parameters of the dataset and layer.
|
|
605
|
-
* @returns {this}
|
|
606
|
-
*/
|
|
607
|
-
/*addMultiScaleParquetGridLayer(resolutions, resToURL, styles, opts) {
|
|
608
|
-
const ds = this.makeMultiScaleParquetGridDataset(resolutions, resToURL, opts)
|
|
609
|
-
return this.addLayerFromDataset(ds, styles, opts);
|
|
610
|
-
}*/
|
|
611
|
-
|
|
612
556
|
/**
|
|
613
557
|
* @param {Array.<number>} resolutions
|
|
614
558
|
* @param {function(number):string} resToURL
|
package/src/DatasetComponent.js
CHANGED
package/src/dataset/TiledGrid.js
CHANGED
|
@@ -11,10 +11,9 @@ import { monitor, monitorDuration } from '../utils/Utils.js'
|
|
|
11
11
|
|
|
12
12
|
// external
|
|
13
13
|
import { json, csv } from 'd3-fetch'
|
|
14
|
-
import { tableFromIPC } from 'apache-arrow'
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
|
-
* A tiled dataset, composed of CSV
|
|
16
|
+
* A tiled dataset, composed of CSV tiles.
|
|
18
17
|
*
|
|
19
18
|
* @author Joseph Davies, Julien Gaffuri
|
|
20
19
|
*/
|
|
@@ -22,7 +21,7 @@ export class TiledGrid extends DatasetComponent {
|
|
|
22
21
|
/**
|
|
23
22
|
* @param {string} url The URL of the dataset.
|
|
24
23
|
* @param {App} app The application.
|
|
25
|
-
* @param {{preprocess?:(function(import("../Dataset").Cell):boolean)
|
|
24
|
+
* @param {{preprocess?:(function(import("../Dataset").Cell):boolean) }} opts
|
|
26
25
|
*/
|
|
27
26
|
constructor(url, app, opts = {}) {
|
|
28
27
|
super(url, 0, opts)
|
|
@@ -53,10 +52,6 @@ export class TiledGrid extends DatasetComponent {
|
|
|
53
52
|
* */
|
|
54
53
|
this.cache = {}
|
|
55
54
|
|
|
56
|
-
/**
|
|
57
|
-
* @type {Function|undefined}
|
|
58
|
-
* @private */
|
|
59
|
-
this.readParquetFun = opts.readParquetFun
|
|
60
55
|
}
|
|
61
56
|
|
|
62
57
|
/**
|
|
@@ -67,7 +62,7 @@ export class TiledGrid extends DatasetComponent {
|
|
|
67
62
|
*/
|
|
68
63
|
loadInfo(callback) {
|
|
69
64
|
if (!this.info && this.infoLoadingStatus === 'notLoaded') {
|
|
70
|
-
;(async () => {
|
|
65
|
+
; (async () => {
|
|
71
66
|
try {
|
|
72
67
|
const data = await json(this.url + 'info.json')
|
|
73
68
|
this.info = data
|
|
@@ -93,7 +88,7 @@ export class TiledGrid extends DatasetComponent {
|
|
|
93
88
|
*/
|
|
94
89
|
getTilingEnvelope(e) {
|
|
95
90
|
if (!this.info) {
|
|
96
|
-
this.loadInfo(() => {})
|
|
91
|
+
this.loadInfo(() => { })
|
|
97
92
|
return
|
|
98
93
|
}
|
|
99
94
|
|
|
@@ -131,8 +126,6 @@ export class TiledGrid extends DatasetComponent {
|
|
|
131
126
|
/** @type {import("../Dataset").Envelope} */
|
|
132
127
|
const gb = this.info.tilingBounds
|
|
133
128
|
|
|
134
|
-
const format = this.info.format
|
|
135
|
-
|
|
136
129
|
for (let xT = Math.max(tb.xMin, gb.xMin); xT <= Math.min(tb.xMax, gb.xMax); xT++) {
|
|
137
130
|
for (let yT = Math.max(tb.yMin, gb.yMin); yT <= Math.min(tb.yMax, gb.yMax); yT++) {
|
|
138
131
|
//prepare cache
|
|
@@ -145,13 +138,12 @@ export class TiledGrid extends DatasetComponent {
|
|
|
145
138
|
|
|
146
139
|
//mark tile as loading
|
|
147
140
|
this.cache[xT][yT] = 'loading'
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
; (async () => {
|
|
142
|
+
//request tile
|
|
143
|
+
/** @type {Array.<import("../Dataset").Cell>} */
|
|
144
|
+
let cells
|
|
152
145
|
|
|
153
|
-
|
|
154
|
-
if (!format || format === 'CSV') {
|
|
146
|
+
try {
|
|
155
147
|
/** @type {Array.<import("../Dataset").Cell>} */
|
|
156
148
|
// @ts-ignore
|
|
157
149
|
const data = await csv(this.url + xT + '/' + yT + '.csv')
|
|
@@ -171,80 +163,56 @@ export class TiledGrid extends DatasetComponent {
|
|
|
171
163
|
}
|
|
172
164
|
|
|
173
165
|
if (monitor) monitorDuration('preprocess / filter')
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if (!lay.visible) continue
|
|
225
|
-
if (lay.getDatasetComponent(zf) != this) continue
|
|
226
|
-
//found one layer. No need to seek more.
|
|
227
|
-
redraw = true
|
|
228
|
-
break
|
|
229
|
-
}
|
|
230
|
-
if (monitor) monitorDuration('check redraw 1')
|
|
231
|
-
|
|
232
|
-
if (!redraw) return
|
|
233
|
-
|
|
234
|
-
// 2. the tile is within the view, that is its geo envelope intersects the viewer geo envelope.
|
|
235
|
-
const env = this.app.updateExtentGeo()
|
|
236
|
-
const envT = tile_.extGeo
|
|
237
|
-
if (env.xMax <= envT.xMin) return
|
|
238
|
-
if (env.xMin >= envT.xMax) return
|
|
239
|
-
if (env.yMax <= envT.yMin) return
|
|
240
|
-
if (env.yMin >= envT.yMax) return
|
|
241
|
-
|
|
242
|
-
if (monitor) monitorDuration('check redraw 2')
|
|
243
|
-
if (monitor) monitorDuration('*** TiledGrid parse end')
|
|
244
|
-
|
|
245
|
-
//redraw
|
|
246
|
-
redrawFun()
|
|
247
|
-
})()
|
|
166
|
+
} catch (error) {
|
|
167
|
+
//mark as failed
|
|
168
|
+
this.cache[xT][yT] = 'failed'
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//store tile in cache
|
|
173
|
+
if (!this.info) {
|
|
174
|
+
console.error('Tile info inknown')
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
const tile_ = new GridTile(cells, xT, yT, this.info)
|
|
178
|
+
this.cache[xT][yT] = tile_
|
|
179
|
+
|
|
180
|
+
if (monitor) monitorDuration('storage')
|
|
181
|
+
|
|
182
|
+
//if no redraw is specified, then leave
|
|
183
|
+
if (!redrawFun) return
|
|
184
|
+
|
|
185
|
+
//check if redraw is really needed, that is if:
|
|
186
|
+
|
|
187
|
+
// 1. the dataset belongs to a layer which is visible at the current zoom level
|
|
188
|
+
let redraw = false
|
|
189
|
+
//go through the layers
|
|
190
|
+
const zf = this.app.getZoomFactor()
|
|
191
|
+
for (const lay of this.app.layers) {
|
|
192
|
+
if (!lay.visible) continue
|
|
193
|
+
if (lay.getDatasetComponent(zf) != this) continue
|
|
194
|
+
//found one layer. No need to seek more.
|
|
195
|
+
redraw = true
|
|
196
|
+
break
|
|
197
|
+
}
|
|
198
|
+
if (monitor) monitorDuration('check redraw 1')
|
|
199
|
+
|
|
200
|
+
if (!redraw) return
|
|
201
|
+
|
|
202
|
+
// 2. the tile is within the view, that is its geo envelope intersects the viewer geo envelope.
|
|
203
|
+
const env = this.app.updateExtentGeo()
|
|
204
|
+
const envT = tile_.extGeo
|
|
205
|
+
if (env.xMax <= envT.xMin) return
|
|
206
|
+
if (env.xMin >= envT.xMax) return
|
|
207
|
+
if (env.yMax <= envT.yMin) return
|
|
208
|
+
if (env.yMin >= envT.yMax) return
|
|
209
|
+
|
|
210
|
+
if (monitor) monitorDuration('check redraw 2')
|
|
211
|
+
if (monitor) monitorDuration('*** TiledGrid parse end')
|
|
212
|
+
|
|
213
|
+
//redraw
|
|
214
|
+
redrawFun()
|
|
215
|
+
})()
|
|
248
216
|
}
|
|
249
217
|
}
|
|
250
218
|
return this
|
package/src/index.js
CHANGED
|
@@ -12,7 +12,6 @@ export { DatasetComponent } from './DatasetComponent.js'
|
|
|
12
12
|
// export dataset types
|
|
13
13
|
export { TiledGrid } from './dataset/TiledGrid.js'
|
|
14
14
|
export { CSVGrid } from './dataset/CSVGrid.js'
|
|
15
|
-
//export { ParquetGrid } from "./dataset/ParquetGrid"
|
|
16
15
|
//export { GeoTIFF } from "./dataset/GeoTIFF"
|
|
17
16
|
|
|
18
17
|
// export styles
|
|
@@ -22,9 +21,6 @@ export { JoyPlotStyle } from './style/JoyPlotStyle.js'
|
|
|
22
21
|
export { CompositionStyle } from './style/CompositionStyle.js'
|
|
23
22
|
export { SegmentStyle } from './style/SegmentStyle.js'
|
|
24
23
|
export { TextStyle } from './style/TextStyle.js'
|
|
25
|
-
export { KernelSmoothingStyle } from './style/KernelSmoothingStyle.js'
|
|
26
|
-
//export { KernelSmoothingOldStyle } from "./style/KernelSmoothingStyle"
|
|
27
|
-
//export { KernelSmoothingWGLStyle } from "./style/KernelSmoothingStyle"
|
|
28
24
|
export { PillarStyle } from './style/PillarStyle.js'
|
|
29
25
|
export { SideStyle } from './style/SideStyle.js'
|
|
30
26
|
export { ContourStyle } from './style/ContourStyle.js'
|
|
@@ -56,6 +52,9 @@ export * from './utils/stretching.js'
|
|
|
56
52
|
|
|
57
53
|
export { getClass } from './utils/Utils.js'
|
|
58
54
|
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
59
58
|
import { GeoCanvas } from './GeoCanvas.js'
|
|
60
59
|
import { geoAzimuthalEqualArea } from 'd3-geo'
|
|
61
60
|
|
package/src/style/TextStyle.js
CHANGED
|
@@ -18,7 +18,7 @@ export class TextStyle extends Style {
|
|
|
18
18
|
this.textCol = opts.textCol
|
|
19
19
|
|
|
20
20
|
/** A function returning the text of a cell.
|
|
21
|
-
* @type {function(number,number,import("../Style").Stat|undefined):string} */
|
|
21
|
+
* @type {function(number,number,import("../Style").Stat|undefined,number):string} */
|
|
22
22
|
this.text = opts.text || ((v, r, s, z) => 'X')
|
|
23
23
|
|
|
24
24
|
/** The name of the column/attribute of the tabular data where to retrieve the variable for color.
|
|
@@ -26,7 +26,7 @@ export class TextStyle extends Style {
|
|
|
26
26
|
this.colorCol = opts.colorCol
|
|
27
27
|
|
|
28
28
|
/** A function returning the color of the cell.
|
|
29
|
-
* @type {function(number,number,import("../Style").Stat|undefined):string} */
|
|
29
|
+
* @type {function(number,number,import("../Style").Stat|undefined,number):string} */
|
|
30
30
|
this.color = opts.color || (() => '#EA6BAC')
|
|
31
31
|
|
|
32
32
|
/** The name of the column/attribute of the tabular data where to retrieve the variable for font size.
|
|
@@ -86,11 +86,11 @@ export class TextStyle extends Style {
|
|
|
86
86
|
|
|
87
87
|
for (let cell of cells) {
|
|
88
88
|
//get cell text
|
|
89
|
-
const text = this.text ? this.text(cell[this.textCol], r, statText) : undefined
|
|
89
|
+
const text = this.text ? this.text(cell[this.textCol], r, statText, zf) : undefined
|
|
90
90
|
if (text == undefined || text == null || text + '' === '') continue
|
|
91
91
|
|
|
92
92
|
//color
|
|
93
|
-
const col = this.color ? this.color(cell[this.colorCol], r, statColor) : undefined
|
|
93
|
+
const col = this.color ? this.color(cell[this.colorCol], r, statColor, zf) : undefined
|
|
94
94
|
if (!col) continue
|
|
95
95
|
cg.ctx.fillStyle = col
|
|
96
96
|
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
//@ts-check
|
|
2
|
-
'use strict'
|
|
3
|
-
|
|
4
|
-
import { DatasetComponent } from '../DatasetComponent.js'
|
|
5
|
-
import { tableFromIPC } from 'apache-arrow'
|
|
6
|
-
//import { readParquet } from "parquet-wasm"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A dataset composed of a single parquet file (not tiled).
|
|
10
|
-
*
|
|
11
|
-
* @author Julien Gaffuri
|
|
12
|
-
*/
|
|
13
|
-
export class ParquetGrid extends DatasetComponent {
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} url The URL of the dataset.
|
|
16
|
-
* @param {number} resolution The dataset resolution in geographical unit.
|
|
17
|
-
* @param {{preprocess?:(function(import("../Dataset").Cell):boolean), readParquetFun?:Function}} opts
|
|
18
|
-
*/
|
|
19
|
-
constructor(url, resolution, opts = {}) {
|
|
20
|
-
super(url, resolution, opts)
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @private
|
|
24
|
-
* @type {Array.<import("../Dataset").Cell>} */
|
|
25
|
-
this.cells = []
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @type {string}
|
|
29
|
-
* @private */
|
|
30
|
-
this.infoLoadingStatus = 'notLoaded'
|
|
31
|
-
|
|
32
|
-
if (!opts.readParquetFun) throw new Error('readParquet function needed for parquet dataset')
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @type {Function}
|
|
36
|
-
* @private */
|
|
37
|
-
this.readParquetFun = opts.readParquetFun
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Request data within a geographic envelope.
|
|
42
|
-
*
|
|
43
|
-
* @param {import("../Dataset").Envelope|undefined} e
|
|
44
|
-
* @param {function():void} redraw
|
|
45
|
-
*/
|
|
46
|
-
getData(e, redraw) {
|
|
47
|
-
//check if data already loaded
|
|
48
|
-
if (this.infoLoadingStatus != 'notLoaded') return this
|
|
49
|
-
|
|
50
|
-
//load data
|
|
51
|
-
this.infoLoadingStatus = 'loading'
|
|
52
|
-
;(async () => {
|
|
53
|
-
try {
|
|
54
|
-
const resp = await fetch(this.url)
|
|
55
|
-
const parquetUint8Array = new Uint8Array(await resp.arrayBuffer())
|
|
56
|
-
const arrowUint8Array = this.readParquetFun(parquetUint8Array)
|
|
57
|
-
|
|
58
|
-
const t = tableFromIPC(arrowUint8Array)
|
|
59
|
-
//see https://arrow.apache.org/docs/js/
|
|
60
|
-
//https://loaders.gl/arrowjs/docs/developer-guide/tables#record-tojson-and-toarray
|
|
61
|
-
|
|
62
|
-
this.cells = []
|
|
63
|
-
for (const e of t) {
|
|
64
|
-
//get cell
|
|
65
|
-
const c = e.toJSON()
|
|
66
|
-
|
|
67
|
-
//preprocess/filter
|
|
68
|
-
if (this.preprocess) {
|
|
69
|
-
const b = this.preprocess(c)
|
|
70
|
-
if (b == false) continue
|
|
71
|
-
this.cells.push(c)
|
|
72
|
-
} else {
|
|
73
|
-
this.cells.push(c)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
//TODO check if redraw is necessary
|
|
78
|
-
//that is if the dataset belongs to a layer which is visible at the current zoom level
|
|
79
|
-
|
|
80
|
-
//execute the callback, usually a draw function
|
|
81
|
-
if (redraw) redraw()
|
|
82
|
-
|
|
83
|
-
this.infoLoadingStatus = 'loaded'
|
|
84
|
-
} catch (error) {
|
|
85
|
-
//mark as failed
|
|
86
|
-
this.infoLoadingStatus = 'failed'
|
|
87
|
-
this.cells = []
|
|
88
|
-
}
|
|
89
|
-
})()
|
|
90
|
-
|
|
91
|
-
return this
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Fill the view cache with all cells which are within a geographical envelope.
|
|
96
|
-
*
|
|
97
|
-
* @param {import("../Dataset").Envelope} extGeo
|
|
98
|
-
* @returns {void}
|
|
99
|
-
*/
|
|
100
|
-
updateViewCache(extGeo) {
|
|
101
|
-
//data not loaded yet
|
|
102
|
-
if (!this.cells) return
|
|
103
|
-
|
|
104
|
-
this.cellsViewCache = []
|
|
105
|
-
for (const cell of this.cells) {
|
|
106
|
-
if (+cell.x + this.resolution < extGeo.xMin) continue
|
|
107
|
-
if (+cell.x - this.resolution > extGeo.xMax) continue
|
|
108
|
-
if (+cell.y + this.resolution < extGeo.yMin) continue
|
|
109
|
-
if (+cell.y - this.resolution > extGeo.yMax) continue
|
|
110
|
-
this.cellsViewCache.push(cell)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Retrieve parquet wasm decoder
|
|
117
|
-
*/
|
|
118
|
-
const getReadParquet = async () => {
|
|
119
|
-
//const parquetModule = await import("https://unpkg.com/parquet-wasm@0.4.0-beta.5/esm/arrow2.js");
|
|
120
|
-
//await parquetModule.default();
|
|
121
|
-
//return parquetModule.readParquet;
|
|
122
|
-
}
|