gridviz 3.0.8 → 3.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridviz",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Visualization tool for gridded statistics",
5
5
  "keywords": [
6
6
  "statistics",
@@ -3,7 +3,7 @@
3
3
 
4
4
  /** @typedef {{ dims: object, crs: string, tileSizeCell: number, originPoint: {x:number,y:number}, resolutionGeo: number, tilingBounds:import("../core/GeoCanvas.js").Envelope }} GridInfo */
5
5
 
6
- import { csv } from 'd3-fetch'
6
+ import { dsv } from 'd3-fetch'
7
7
  import { Dataset } from '../core/Dataset.js'
8
8
 
9
9
  /**
@@ -17,7 +17,7 @@ export class CSVGrid extends Dataset {
17
17
  * @param {import("../core/Map.js").Map} map The map.
18
18
  * @param {string} url The URL of the dataset.
19
19
  * @param {number} resolution The dataset resolution in geographical unit.
20
- * @param {{preprocess?:(function(import("../core/Dataset.js").Cell):boolean)}} opts
20
+ * @param {{preprocess?:(function(import("../core/Dataset.js").Cell):boolean),delimiter?:string}} opts
21
21
  */
22
22
  constructor(map, url, resolution, opts = {}) {
23
23
  super(map, url, resolution, opts)
@@ -27,6 +27,11 @@ export class CSVGrid extends Dataset {
27
27
  * @type {Array.<import("../core/Dataset.js").Cell>} */
28
28
  this.cells = []
29
29
 
30
+ /**
31
+ * @private
32
+ * @type {string} */
33
+ this.delimiter = opts.delimiter || ","
34
+
30
35
  /**
31
36
  * @type {string}
32
37
  * @private */
@@ -48,7 +53,7 @@ export class CSVGrid extends Dataset {
48
53
  this.infoLoadingStatus = 'loading'
49
54
  ; (async () => {
50
55
  try {
51
- const data = await csv(this.url)
56
+ const data = await dsv(this.delimiter, this.url)
52
57
 
53
58
  //convert coordinates in numbers
54
59
  for (const c of data) {
@@ -71,7 +76,7 @@ export class CSVGrid extends Dataset {
71
76
  //TODO check if redraw is necessary
72
77
  //that is if the dataset belongs to a layer which is visible at the current zoom level
73
78
 
74
- //execute the callback, usually a draw function
79
+ //redraw map
75
80
  if (this.map) this.map.redraw()
76
81
 
77
82
  this.infoLoadingStatus = 'loaded'