gridviz 3.0.34 → 3.0.36

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 +129 -129
  2. package/dist/gridviz.js +17487 -17471
  3. package/dist/gridviz.min.js +2 -2
  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 +568 -552
  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 +79 -79
  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 +276 -276
  28. package/src/layer/GridLayer.js +166 -166
  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/DotDensityStyle.js +133 -133
  38. package/src/style/ImageStyle.js +100 -100
  39. package/src/style/Interpolator.js +258 -258
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +180 -180
  42. package/src/style/LegoStyle.js +132 -132
  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/ShadingRayStyle.js +280 -280
  48. package/src/style/ShadingStyle.js +72 -72
  49. package/src/style/ShapeColorSizeStyle.js +147 -147
  50. package/src/style/SideCategoryStyle.js +112 -112
  51. package/src/style/SideStyle.js +217 -217
  52. package/src/style/SideTanakaStyle.js +154 -154
  53. package/src/style/SquareColorCategoryWebGLStyle.js +307 -294
  54. package/src/style/SquareColorWebGLStyle.js +126 -126
  55. package/src/style/StrokeStyle.js +135 -135
  56. package/src/style/TextStyle.js +110 -110
  57. package/src/style/TimeSeriesStyle.js +222 -222
  58. package/src/utils/WebGLRectangleColoring.js +106 -106
  59. package/src/utils/WebGLSquareColoring.js +118 -118
  60. package/src/utils/WebGLSquareColoringAdvanced.js +227 -227
  61. package/src/utils/WebGLSquareColoringKS.js +153 -153
  62. package/src/utils/scale.js +255 -255
  63. package/src/utils/stretching.js +120 -120
  64. package/src/utils/ternary.js +208 -208
  65. package/src/utils/utils.js +125 -125
  66. package/src/utils/webGLUtils.js +73 -73
  67. package/src/utils/zoomUtils.js +142 -142
package/README.md CHANGED
@@ -1,129 +1,129 @@
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 - Census total population](https://ec.europa.eu/assets/estat/E/E4/gisco/website/grid_map/index.html)
33
- - [**Europe** - 1km resolution - Census population composition](https://ec.europa.eu/assets/estat/E/E4/gisco/website/census_2021_grid_map/index.html)
34
- - [**Europe** - 100m resolution - Accessibility to basic services](https://ec.europa.eu/assets/estat/E/E4/gisco/accessibility_maps/healthcare_education/index.html)
35
- - [**Europe** - 100m resolution - Relief](https://eurostat.github.io/gridviz/examples/demos/EUR_relief.html)
36
- - [**Germany** - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/demos/DE.html)
37
- - [**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).
38
- - [**Norway** - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/demos/NO.html)
39
- - [**Croatia** - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/demos/HR.html)
40
- - [**Belgium** population](https://eurostat.github.io/gridviz/examples/basics/mixed_resolution_BE.html), as mixed resolution layer.
41
-
42
- ## Installation
43
-
44
- ### Node.js
45
-
46
- ```Shell
47
- npm install gridviz
48
- ```
49
-
50
- then
51
-
52
- ```javascript
53
- import * as gridviz from 'gridviz'
54
- ```
55
-
56
- Or you can cherry-pick only the modules that you need, for example:
57
-
58
- ```javascript
59
- import { Map, SquareColorWebGLStyle } from 'gridviz'
60
- ```
61
-
62
- ### Basic example
63
-
64
- Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
65
-
66
- ```javascript
67
- //define map with initial view
68
- const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
69
-
70
- //define dataset
71
- const dataset = new gridviz.CSVGrid(
72
- map,
73
- 'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv',
74
- 10000
75
- )
76
-
77
- //define color for each cell
78
- const colorFunction = (cell) => {
79
- if (cell.population > 150000) return '#993404'
80
- else if (cell.population > 60000) return '#d95f0e'
81
- else if (cell.population > 20000) return '#fe9929'
82
- else if (cell.population > 6000) return '#fec44f'
83
- else if (cell.population > 1500) return '#fee391'
84
- else return '#ffffd4'
85
- }
86
-
87
- //define style
88
- const style = new gridviz.ShapeColorSizeStyle({ color: colorFunction })
89
-
90
- //add layer to map
91
- map.layers = [new gridviz.GridLayer(dataset, [style])]
92
- ```
93
-
94
- See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference)** for more information.
95
-
96
- ### standalone
97
-
98
- ```javascript
99
- <script src="https://unpkg.com/gridviz/dist/gridviz.min.js"></script>
100
- ```
101
-
102
- ## Documentation
103
-
104
- See the **[gridviz documentation page](./docs/reference.md)**.
105
-
106
- ## Grid tiling
107
-
108
- 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)**.
109
-
110
- ## About
111
-
112
- | | |
113
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
- | _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) |
115
- | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
116
- | _status_ | Since 2020 |
117
- | _license_ | [EUPL 1.2](LICENSE) |
118
-
119
- ### Support and contribution
120
-
121
- Feel free to [ask support](https://github.com/eurostat/gridviz/issues/new), fork the project or simply star it (it's always a pleasure).
122
-
123
- ### Copyright
124
-
125
- 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.
126
-
127
- ### Disclaimer
128
-
129
- 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 - Census total population](https://ec.europa.eu/assets/estat/E/E4/gisco/website/grid_map/index.html)
33
+ - [**Europe** - 1km resolution - Census population composition](https://ec.europa.eu/assets/estat/E/E4/gisco/website/census_2021_grid_map/index.html)
34
+ - [**Europe** - 100m resolution - Accessibility to basic services](https://ec.europa.eu/assets/estat/E/E4/gisco/accessibility_maps/healthcare_education/index.html)
35
+ - [**Europe** - 100m resolution - Relief](https://eurostat.github.io/gridviz/examples/demos/EUR_relief.html)
36
+ - [**Germany** - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/demos/DE.html)
37
+ - [**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).
38
+ - [**Norway** - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/demos/NO.html)
39
+ - [**Croatia** - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/demos/HR.html)
40
+ - [**Belgium** population](https://eurostat.github.io/gridviz/examples/basics/mixed_resolution_BE.html), as mixed resolution layer.
41
+
42
+ ## Installation
43
+
44
+ ### Node.js
45
+
46
+ ```Shell
47
+ npm install gridviz
48
+ ```
49
+
50
+ then
51
+
52
+ ```javascript
53
+ import * as gridviz from 'gridviz'
54
+ ```
55
+
56
+ Or you can cherry-pick only the modules that you need, for example:
57
+
58
+ ```javascript
59
+ import { Map, SquareColorWebGLStyle } from 'gridviz'
60
+ ```
61
+
62
+ ### Basic example
63
+
64
+ Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
65
+
66
+ ```javascript
67
+ //define map with initial view
68
+ const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
69
+
70
+ //define dataset
71
+ const dataset = new gridviz.CSVGrid(
72
+ map,
73
+ 'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv',
74
+ 10000
75
+ )
76
+
77
+ //define color for each cell
78
+ const colorFunction = (cell) => {
79
+ if (cell.population > 150000) return '#993404'
80
+ else if (cell.population > 60000) return '#d95f0e'
81
+ else if (cell.population > 20000) return '#fe9929'
82
+ else if (cell.population > 6000) return '#fec44f'
83
+ else if (cell.population > 1500) return '#fee391'
84
+ else return '#ffffd4'
85
+ }
86
+
87
+ //define style
88
+ const style = new gridviz.ShapeColorSizeStyle({ color: colorFunction })
89
+
90
+ //add layer to map
91
+ map.layers = [new gridviz.GridLayer(dataset, [style])]
92
+ ```
93
+
94
+ See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference)** for more information.
95
+
96
+ ### standalone
97
+
98
+ ```javascript
99
+ <script src="https://unpkg.com/gridviz/dist/gridviz.min.js"></script>
100
+ ```
101
+
102
+ ## Documentation
103
+
104
+ See the **[gridviz documentation page](./docs/reference.md)**.
105
+
106
+ ## Grid tiling
107
+
108
+ 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)**.
109
+
110
+ ## About
111
+
112
+ | | |
113
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
+ | _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) |
115
+ | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
116
+ | _status_ | Since 2020 |
117
+ | _license_ | [EUPL 1.2](LICENSE) |
118
+
119
+ ### Support and contribution
120
+
121
+ Feel free to [ask support](https://github.com/eurostat/gridviz/issues/new), fork the project or simply star it (it's always a pleasure).
122
+
123
+ ### Copyright
124
+
125
+ 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.
126
+
127
+ ### Disclaimer
128
+
129
+ 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.