gridviz 3.0.26 → 3.0.28

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 +126 -128
  2. package/dist/gridviz.js +8798 -8706
  3. package/dist/gridviz.min.js +1 -1
  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 +544 -544
  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 +78 -77
  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 +224 -214
  28. package/src/layer/GridLayer.js +149 -148
  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/ContourStyle.js +21 -21
  38. package/src/style/DotDensityStyle.js +133 -133
  39. package/src/style/ImageStyle.js +100 -100
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +127 -127
  42. package/src/style/LegoStyle.js +110 -110
  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/ShadingStyle.js +61 -0
  48. package/src/style/ShapeColorSizeStyle.js +147 -147
  49. package/src/style/SideCategoryStyle.js +112 -112
  50. package/src/style/SideStyle.js +212 -212
  51. package/src/style/SquareColorCategoryWebGLStyle.js +107 -107
  52. package/src/style/SquareColorWebGLStyle.js +126 -126
  53. package/src/style/StrokeStyle.js +135 -135
  54. package/src/style/TanakaStyle.js +69 -69
  55. package/src/style/TextStyle.js +110 -110
  56. package/src/style/TimeSeriesStyle.js +222 -222
  57. package/src/utils/WebGLRectangleColoring.js +106 -106
  58. package/src/utils/WebGLSquareColoring.js +118 -118
  59. package/src/utils/WebGLSquareColoringAdvanced.js +230 -230
  60. package/src/utils/WebGLSquareColoringCatAdvanced.js +133 -133
  61. package/src/utils/WebGLSquareColoringKS.js +153 -153
  62. package/src/utils/scale.js +218 -218
  63. package/src/utils/stretching.js +120 -120
  64. package/src/utils/ternary.js +208 -208
  65. package/src/utils/utils.js +58 -58
  66. package/src/utils/webGLUtils.js +72 -72
  67. package/src/utils/zoomUtils.js +142 -142
package/README.md CHANGED
@@ -1,128 +1,126 @@
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
- [![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
7
-
8
- <p align="center" style="height: 350px;">
9
- <img src="docs/img/gif/gridviz-annotated.gif">
10
- </p>
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
- ## Live Demos
31
-
32
- - [**Europe** - 1km resolution - GEOSTAT/GISCO](https://eurostat.github.io/gridviz/examples/demos/EUR.html)
33
- - [**Germany** - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/demos/DE.html)
34
- - [**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).
35
- - [**Norway** - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/demos/NO.html)
36
- - [**Croatia** - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/demos/HR.html)
37
- - [**Belgium** population](https://eurostat.github.io/gridviz/examples/basics/mixed_resolution_BE.html), as mixed resolution layer.
38
-
39
- ## Installation
40
-
41
- ### Node.js
42
-
43
- ```Shell
44
- npm install gridviz
45
- ```
46
-
47
- then
48
-
49
- ```javascript
50
- import * as gridviz from 'gridviz'
51
- ```
52
-
53
- Or you can cherry-pick only the modules that you need, for example:
54
-
55
- ```javascript
56
- import { Map, SquareColorWebGLStyle } from 'gridviz'
57
- ```
58
-
59
- ### Basic example
60
-
61
- Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
62
-
63
- ```javascript
64
- //define map with initial view
65
- const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
66
-
67
- //define dataset
68
- const dataset = new gridviz.CSVGrid(
69
- map,
70
- 'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv',
71
- 10000
72
- )
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/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.
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
+ [![Mentioned in Awesome Official Statistics ](https://awesome.re/mentioned-badge.svg)](http://www.awesomeofficialstatistics.org)
7
+
8
+ <p align="center" style="height: 350px;">
9
+ <img src="docs/img/gif/gridviz-annotated.gif">
10
+ </p>
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
+ ## Live Demos
31
+
32
+ - [**Europe** - 1km resolution - GEOSTAT/GISCO](https://eurostat.github.io/gridviz/examples/demos/EUR.html)
33
+ - [**Germany** - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/demos/DE.html)
34
+ - [**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).
35
+ - [**Norway** - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/demos/NO.html)
36
+ - [**Croatia** - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/demos/HR.html)
37
+ - [**Belgium** population](https://eurostat.github.io/gridviz/examples/basics/mixed_resolution_BE.html), as mixed resolution layer.
38
+
39
+ ## Installation
40
+
41
+ ### Node.js
42
+
43
+ ```Shell
44
+ npm install gridviz
45
+ ```
46
+
47
+ then
48
+
49
+ ```javascript
50
+ import * as gridviz from 'gridviz'
51
+ ```
52
+
53
+ Or you can cherry-pick only the modules that you need, for example:
54
+
55
+ ```javascript
56
+ import { Map, SquareColorWebGLStyle } from 'gridviz'
57
+ ```
58
+
59
+ ### Basic example
60
+
61
+ Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
62
+
63
+ ```javascript
64
+ //define map with initial view
65
+ const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
66
+
67
+ //define dataset
68
+ const dataset = new gridviz.CSVGrid(
69
+ map,
70
+ 'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv',
71
+ 10000
72
+ )
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
+ ## Grid tiling
104
+
105
+ 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)**.
106
+
107
+ ## About
108
+
109
+ | | |
110
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
111
+ | _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) |
112
+ | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
113
+ | _status_ | Since 2020 |
114
+ | _license_ | [EUPL 1.2](LICENSE) |
115
+
116
+ ### Support and contribution
117
+
118
+ Feel free to [ask support](https://github.com/eurostat/gridviz/issues/new), fork the project or simply star it (it's always a pleasure).
119
+
120
+ ### Copyright
121
+
122
+ 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.
123
+
124
+ ### Disclaimer
125
+
126
+ 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.