gridviz 3.0.15 → 3.0.17

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 +127 -128
  2. package/dist/gridviz.js +7958 -7861
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +74 -74
  5. package/src/button/ZoomButtons.js +101 -96
  6. package/src/core/Dataset.js +154 -157
  7. package/src/core/Drawable.js +60 -61
  8. package/src/core/GeoCanvas.js +409 -370
  9. package/src/core/Layer.js +23 -25
  10. package/src/core/Legend.js +108 -110
  11. package/src/core/Map.js +494 -495
  12. package/src/core/MultiResolutionDataset.js +93 -97
  13. package/src/core/Style.js +98 -99
  14. package/src/dataset/CSVGrid.js +112 -112
  15. package/src/dataset/GeoTIFF.js +122 -123
  16. package/src/dataset/JSGrid.js +55 -54
  17. package/src/dataset/TiledGrid.js +289 -288
  18. package/src/dataset/worker.js +18 -0
  19. package/src/index.js +77 -71
  20. package/src/layer/BackgroundLayer.js +162 -158
  21. package/src/layer/BackgroundLayerImage.js +81 -84
  22. package/src/layer/BackgroundLayerWMS.js +104 -108
  23. package/src/layer/GeoJSONLayer.js +214 -220
  24. package/src/layer/GridLayer.js +148 -157
  25. package/src/layer/LabelLayer.js +194 -193
  26. package/src/legend/ColorCategoryLegend.js +109 -110
  27. package/src/legend/ColorDiscreteLegend.js +100 -102
  28. package/src/legend/ColorLegend.js +115 -118
  29. package/src/legend/OrientationLegend.js +89 -91
  30. package/src/legend/SizeLegend.js +224 -224
  31. package/src/legend/TernaryLegend.js +302 -210
  32. package/src/style/CompositionStyle.js +291 -288
  33. package/src/style/DotDensityStyle.js +133 -134
  34. package/src/style/ImageStyle.js +100 -102
  35. package/src/style/IsoFenceStyle.js +217 -203
  36. package/src/style/JoyPlotStyle.js +127 -128
  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 -208
  41. package/src/style/SegmentStyle.js +105 -105
  42. package/src/style/ShapeColorSizeStyle.js +147 -132
  43. package/src/style/SideCategoryStyle.js +112 -114
  44. package/src/style/SideStyle.js +212 -205
  45. package/src/style/SquareColorCategoryWebGLStyle.js +107 -108
  46. package/src/style/SquareColorWebGLStyle.js +126 -126
  47. package/src/style/StrokeStyle.js +135 -136
  48. package/src/style/TanakaStyle.js +69 -68
  49. package/src/style/TextStyle.js +110 -111
  50. package/src/style/TimeSeriesStyle.js +222 -229
  51. package/src/utils/scale.js +218 -228
  52. package/src/utils/stretching.js +120 -133
  53. package/src/utils/ternary.js +203 -204
  54. package/src/utils/utils.js +58 -63
  55. package/src/utils/webGLUtils.js +72 -70
package/README.md CHANGED
@@ -1,128 +1,127 @@
1
- # Gridviz
2
-
3
- ![npm bundle size](https://img.shields.io/bundlephobia/minzip/gridviz)
4
- ![npm](https://img.shields.io/npm/v/gridviz)
5
- ![license](https://img.shields.io/badge/license-EUPL-success)
6
-
7
- <p align="center" style="height: 350px;">
8
- <img src="docs/img/banner.png">
9
- </p>
10
-
11
-
12
- [Gridviz](https://github.com/eurostat/gridviz/) is a JavaScript library for visualizing gridded data (or any tabular dataset with x/y coordinates for that matter) in the browser using a large variety of [cartographic styles and techniques](https://github.com/eurostat/gridviz/blob/master/docs/gallery.md). Unlike traditional raster-based web mapping tools, Gridviz renders everything client-side, on the fly.
13
-
14
- ## Styles
15
-
16
- [Visit the style gallery](https://github.com/eurostat/gridviz/blob/master/docs/gallery.md) to see the different customisable styles available for visualizing gridded data with gridviz.
17
-
18
- [<img src="docs/img/overviews/ov_accessibility.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#shapecolorsize-style)
19
- [<img src="docs/img/overviews/ov_side_cat.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#side-category-style)
20
- [<img src="docs/img/overviews/ov_age_balance.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#shapecolorsize-style)
21
- [<img src="docs/img/overviews/ov_dark.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#square-color-webgl-style)
22
- [<img src="docs/img/overviews/ov_kersmoo.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#kernel-smoothing)
23
- [<img src="docs/img/overviews/ov_tanaka_dark.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#tanaka-style)
24
- [<img src="docs/img/overviews/ov_joyplot_shade.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#joyplot-style)
25
- [<img src="docs/img/overviews/ov_lego.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#lego-style)
26
- [<img src="docs/img/overviews/ov_text_elevation.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#text-style)
27
- [<img src="docs/img/overviews/ov_dotdensity.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#dot-density-style)
28
- [<img src="docs/img/overviews/ov_joyplot.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#joyplot-style)
29
-
30
-
31
- ## Live Demos
32
-
33
- - [Europe - 1km resolution - GEOSTAT/GISCO](https://eurostat.github.io/gridviz/examples/demos/EUR.html)
34
- - [Germany - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/demos/DE.html)
35
- - [France - 200m resolution - INSEE Filosofi](https://eurostat.github.io/gridviz/examples/demos/FR.html). Focus on [total population](https://eurostat.github.io/gridviz/examples/demos/FR_pop.html) and [income](https://eurostat.github.io/gridviz/examples/demos/FR_income.html).
36
- - [Norway - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/demos/NO.html)
37
- - [Croatia - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/demos/HR.html)
38
- - [France population, dark style](https://eurostat.github.io/gridviz/examples/styles/squarecolorwgl_dark.html)
39
- - [Europe population as a mosaic](https://eurostat.github.io/gridviz/examples/styles/mosaic_full.html)
40
- - [Belgium population](https://eurostat.github.io/gridviz/examples/basics/mixed_resolution_BE.html), as mixed resolution layer.
41
-
42
-
43
- ## Installation
44
-
45
- ### Node.js
46
-
47
- ```Shell
48
- npm install gridviz
49
- ```
50
-
51
- then
52
-
53
- ```javascript
54
- import * as gridviz from 'gridviz'
55
- ```
56
-
57
- Or you can cherry-pick only the modules that you need, for example:
58
-
59
- ```javascript
60
- import { Map, SquareColorWebGLStyle } from 'gridviz'
61
- ```
62
-
63
- ### Basic example
64
-
65
- Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
66
-
67
- ```javascript
68
- //define map with initial view
69
- const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
70
-
71
- //define dataset
72
- const dataset = new gridviz.CSVGrid(map, "https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv", 10000)
73
-
74
- //define color for each cell
75
- const colorFunction = (cell) => {
76
- if (cell.population > 150000) return "#993404"
77
- else if (cell.population > 60000) return "#d95f0e"
78
- else if (cell.population > 20000) return "#fe9929"
79
- else if (cell.population > 6000) return "#fec44f"
80
- else if (cell.population > 1500) return "#fee391"
81
- else return "#ffffd4"
82
- }
83
-
84
- //define style
85
- const style = new gridviz.ShapeColorSizeStyle({ color: colorFunction })
86
-
87
- //add layer to map
88
- map.layers = [new gridviz.GridLayer(dataset, [style])]
89
- ```
90
-
91
- See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference)** for more information.
92
-
93
- ### standalone
94
-
95
- ```javascript
96
- <script src="https://unpkg.com/gridviz/dist/gridviz.min.js"></script>
97
- ```
98
-
99
- ## Documentation
100
-
101
- See the **[gridviz documentation page](./docs/reference.md)**.
102
-
103
- The document of [the previous version 2](./docs/reference_v2.md).
104
-
105
- ## Grid tiling
106
-
107
- In order to visualize large grids efficiently, you can produce tiled grids in a [tiled grid format](https://eurostat.github.io/gridviz/docs/tiledformat) with **[GridTiler](https://github.com/eurostat/gridtiler)**.
108
-
109
- ## About
110
-
111
- | | |
112
- | -------------- | ----------- |
113
- | _contributors_ | [<img src="https://github.com/jgaffuri.png" height="40" />](https://github.com/jgaffuri) [<img src="https://github.com/JoeWDavies.png" height="40" />](https://github.com/JoeWDavies) |
114
- | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
115
- | _status_ | Since 2020 |
116
- | _license_ | [EUPL 1.2](LICENSE) |
117
-
118
- ### Support and contribution
119
-
120
- Feel free to [ask support](https://github.com/eurostat/gridviz/issues/new), fork the project or simply star it (it's always a pleasure).
121
-
122
- ### Copyright
123
-
124
- The [Eurostat NUTS dataset](http://ec.europa.eu/eurostat/web/nuts/overview) is copyrighted. There are [specific provisions](https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units) for the usage of this dataset which must be respected. The usage of these data is subject to their acceptance. See the [Eurostat-GISCO website](http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts) for more information.
125
-
126
- ### Disclaimer
127
-
128
- The designations employed and the presentation of material on these maps do not imply the expression of any opinion whatsoever on the part of the European Union concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. Kosovo*: This designation is without prejudice to positions on status, and is in line with UNSCR 1244/1999 and the ICJ Opinion on the Kosovo declaration of independence. Palestine*: This designation shall not be construed as recognition of a State of Palestine and is without prejudice to the individual positions of the Member States on this issue.
1
+ # Gridviz
2
+
3
+ ![npm bundle size](https://img.shields.io/bundlephobia/minzip/gridviz)
4
+ ![npm](https://img.shields.io/npm/v/gridviz)
5
+ ![license](https://img.shields.io/badge/license-EUPL-success)
6
+
7
+ <p align="center" style="height: 350px;">
8
+ <img src="docs/img/gif/gridviz-annotated.gif">
9
+ </p>
10
+
11
+ [Gridviz](https://github.com/eurostat/gridviz/) is a JavaScript library for visualizing gridded data (or any tabular dataset with x/y coordinates for that matter) in the browser using a large variety of [cartographic styles and techniques](https://github.com/eurostat/gridviz/blob/master/docs/gallery.md). Unlike traditional raster-based web mapping tools, Gridviz renders everything client-side, on the fly.
12
+
13
+ ## Styles
14
+
15
+ [Visit the style gallery](https://github.com/eurostat/gridviz/blob/master/docs/gallery.md) to see the different customisable styles available for visualizing gridded data with gridviz.
16
+
17
+ [<img src="docs/img/overviews/ov_accessibility.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#shapecolorsize-style)
18
+ [<img src="docs/img/overviews/ov_side_cat.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#side-category-style)
19
+ [<img src="docs/img/overviews/ov_age_balance.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#shapecolorsize-style)
20
+ [<img src="docs/img/overviews/ov_dark.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#square-color-webgl-style)
21
+ [<img src="docs/img/overviews/ov_kersmoo.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#kernel-smoothing)
22
+ [<img src="docs/img/overviews/ov_tanaka_dark.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#tanaka-style)
23
+ [<img src="docs/img/overviews/ov_joyplot_shade.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#joyplot-style)
24
+ [<img src="docs/img/overviews/ov_lego.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#lego-style)
25
+ [<img src="docs/img/overviews/ov_text_elevation.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#text-style)
26
+ [<img src="docs/img/overviews/ov_dotdensity.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#dot-density-style)
27
+ [<img src="docs/img/overviews/ov_joyplot.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#joyplot-style)
28
+
29
+ ## Live Demos
30
+
31
+ - [**Europe** - 1km resolution - GEOSTAT/GISCO](https://eurostat.github.io/gridviz/examples/demos/EUR.html)
32
+ - [**Germany** - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/demos/DE.html)
33
+ - [**France** - 200m resolution - INSEE Filosofi](https://eurostat.github.io/gridviz/examples/demos/FR.html). Focus on [total population](https://eurostat.github.io/gridviz/examples/demos/FR_pop.html) and [income](https://eurostat.github.io/gridviz/examples/demos/FR_income.html).
34
+ - [**Norway** - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/demos/NO.html)
35
+ - [**Croatia** - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/demos/HR.html)
36
+ - [**Belgium** population](https://eurostat.github.io/gridviz/examples/basics/mixed_resolution_BE.html), as mixed resolution layer.
37
+
38
+ ## Installation
39
+
40
+ ### Node.js
41
+
42
+ ```Shell
43
+ npm install gridviz
44
+ ```
45
+
46
+ then
47
+
48
+ ```javascript
49
+ import * as gridviz from 'gridviz'
50
+ ```
51
+
52
+ Or you can cherry-pick only the modules that you need, for example:
53
+
54
+ ```javascript
55
+ import { Map, SquareColorWebGLStyle } from 'gridviz'
56
+ ```
57
+
58
+ ### Basic example
59
+
60
+ Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
61
+
62
+ ```javascript
63
+ //define map with initial view
64
+ const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
65
+
66
+ //define dataset
67
+ const dataset = new gridviz.CSVGrid(
68
+ map,
69
+ 'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv',
70
+ 10000
71
+ )
72
+
73
+ //define color for each cell
74
+ const colorFunction = (cell) => {
75
+ if (cell.population > 150000) return '#993404'
76
+ else if (cell.population > 60000) return '#d95f0e'
77
+ else if (cell.population > 20000) return '#fe9929'
78
+ else if (cell.population > 6000) return '#fec44f'
79
+ else if (cell.population > 1500) return '#fee391'
80
+ else return '#ffffd4'
81
+ }
82
+
83
+ //define style
84
+ const style = new gridviz.ShapeColorSizeStyle({ color: colorFunction })
85
+
86
+ //add layer to map
87
+ map.layers = [new gridviz.GridLayer(dataset, [style])]
88
+ ```
89
+
90
+ See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference)** for more information.
91
+
92
+ ### standalone
93
+
94
+ ```javascript
95
+ <script src="https://unpkg.com/gridviz/dist/gridviz.min.js"></script>
96
+ ```
97
+
98
+ ## Documentation
99
+
100
+ See the **[gridviz documentation page](./docs/reference.md)**.
101
+
102
+ The document of [the previous version 2](./docs/reference_v2.md).
103
+
104
+ ## Grid tiling
105
+
106
+ In order to visualize large grids efficiently, you can produce tiled grids in a [tiled grid format](https://eurostat.github.io/gridviz/docs/tiledformat) with **[GridTiler](https://github.com/eurostat/gridtiler)**.
107
+
108
+ ## About
109
+
110
+ | | |
111
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
112
+ | _contributors_ | [<img src="https://github.com/jgaffuri.png" height="40" />](https://github.com/jgaffuri) [<img src="https://github.com/JoeWDavies.png" height="40" />](https://github.com/JoeWDavies) |
113
+ | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
114
+ | _status_ | Since 2020 |
115
+ | _license_ | [EUPL 1.2](LICENSE) |
116
+
117
+ ### Support and contribution
118
+
119
+ Feel free to [ask support](https://github.com/eurostat/gridviz/issues/new), fork the project or simply star it (it's always a pleasure).
120
+
121
+ ### Copyright
122
+
123
+ The [Eurostat NUTS dataset](http://ec.europa.eu/eurostat/web/nuts/overview) is copyrighted. There are [specific provisions](https://ec.europa.eu/eurostat/web/gisco/geodata/statistical-units) for the usage of this dataset which must be respected. The usage of these data is subject to their acceptance. See the [Eurostat-GISCO website](https://ec.europa.eu/eurostat/web/gisco/geodata/statistical-units/territorial-units-statistics) for more information.
124
+
125
+ ### Disclaimer
126
+
127
+ The designations employed and the presentation of material on these maps do not imply the expression of any opinion whatsoever on the part of the European Union concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. Kosovo*: This designation is without prejudice to positions on status, and is in line with UNSCR 1244/1999 and the ICJ Opinion on the Kosovo declaration of independence. Palestine*: This designation shall not be construed as recognition of a State of Palestine and is without prejudice to the individual positions of the Member States on this issue.