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.
- package/README.md +126 -128
- package/dist/gridviz.js +8798 -8706
- package/dist/gridviz.min.js +1 -1
- package/package.json +73 -73
- package/src/button/Button.js +67 -67
- package/src/button/FullscreenButton.js +121 -121
- package/src/button/ZoomButtons.js +103 -103
- package/src/core/Dataset.js +154 -154
- package/src/core/Drawable.js +78 -78
- package/src/core/GeoCanvas.js +443 -443
- package/src/core/Layer.js +23 -23
- package/src/core/Legend.js +108 -108
- package/src/core/Map.js +544 -544
- package/src/core/MultiResolutionDataset.js +93 -93
- package/src/core/Style.js +98 -98
- package/src/core/Tooltip.js +182 -182
- package/src/dataset/COGeo.js +25 -25
- package/src/dataset/CSVGrid.js +112 -112
- package/src/dataset/GeoTIFF.js +122 -122
- package/src/dataset/JSGrid.js +55 -55
- package/src/dataset/TiledGrid.js +302 -302
- package/src/dataset/worker.js +18 -18
- package/src/index.js +78 -77
- package/src/layer/BackgroundLayer.js +173 -173
- package/src/layer/BackgroundLayerImage.js +81 -81
- package/src/layer/BackgroundLayerWMS.js +104 -104
- package/src/layer/GeoJSONLayer.js +224 -214
- package/src/layer/GridLayer.js +149 -148
- package/src/layer/LabelLayer.js +194 -194
- package/src/legend/ColorCategoryLegend.js +109 -109
- package/src/legend/ColorDiscreteLegend.js +100 -100
- package/src/legend/ColorLegend.js +115 -115
- package/src/legend/OrientationLegend.js +89 -89
- package/src/legend/SizeLegend.js +224 -224
- package/src/legend/TernaryLegend.js +302 -302
- package/src/style/CompositionStyle.js +291 -291
- package/src/style/ContourStyle.js +21 -21
- package/src/style/DotDensityStyle.js +133 -133
- package/src/style/ImageStyle.js +100 -100
- package/src/style/IsoFenceStyle.js +217 -217
- package/src/style/JoyPlotStyle.js +127 -127
- package/src/style/LegoStyle.js +110 -110
- package/src/style/MosaicStyle.js +99 -99
- package/src/style/NinjaStarStyle.js +102 -102
- package/src/style/PillarStyle.js +207 -207
- package/src/style/SegmentStyle.js +105 -105
- package/src/style/ShadingStyle.js +61 -0
- package/src/style/ShapeColorSizeStyle.js +147 -147
- package/src/style/SideCategoryStyle.js +112 -112
- package/src/style/SideStyle.js +212 -212
- package/src/style/SquareColorCategoryWebGLStyle.js +107 -107
- package/src/style/SquareColorWebGLStyle.js +126 -126
- package/src/style/StrokeStyle.js +135 -135
- package/src/style/TanakaStyle.js +69 -69
- package/src/style/TextStyle.js +110 -110
- package/src/style/TimeSeriesStyle.js +222 -222
- package/src/utils/WebGLRectangleColoring.js +106 -106
- package/src/utils/WebGLSquareColoring.js +118 -118
- package/src/utils/WebGLSquareColoringAdvanced.js +230 -230
- package/src/utils/WebGLSquareColoringCatAdvanced.js +133 -133
- package/src/utils/WebGLSquareColoringKS.js +153 -153
- package/src/utils/scale.js +218 -218
- package/src/utils/stretching.js +120 -120
- package/src/utils/ternary.js +208 -208
- package/src/utils/utils.js +58 -58
- package/src/utils/webGLUtils.js +72 -72
- package/src/utils/zoomUtils.js +142 -142
package/README.md
CHANGED
|
@@ -1,128 +1,126 @@
|
|
|
1
|
-
# Gridviz
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
6
|
-
[](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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
[](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.
|