gridviz 3.0.0 → 3.0.2

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 (54) hide show
  1. package/README.md +36 -33
  2. package/dist/gridviz.js +528 -229
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +4 -3
  5. package/src/button/Button.js +1 -0
  6. package/src/button/FullscreenButton.js +1 -0
  7. package/src/button/ZoomButtons.js +1 -0
  8. package/src/core/Dataset.js +1 -1
  9. package/src/core/Drawable.js +1 -0
  10. package/src/core/GeoCanvas.js +1 -0
  11. package/src/core/Layer.js +1 -0
  12. package/src/core/Legend.js +1 -0
  13. package/src/core/Map.js +15 -0
  14. package/src/core/MultiResolutionDataset.js +1 -0
  15. package/src/core/Style.js +10 -1
  16. package/src/core/Tooltip.js +1 -0
  17. package/src/dataset/COGeo.js +1 -0
  18. package/src/dataset/CSVGrid.js +1 -0
  19. package/src/dataset/GeoTIFF.js +1 -0
  20. package/src/dataset/JSGrid.js +3 -3
  21. package/src/dataset/TiledGrid.js +1 -0
  22. package/src/index.js +3 -3
  23. package/src/layer/BackgroundLayer.js +1 -0
  24. package/src/layer/BackgroundLayerWMS.js +1 -0
  25. package/src/layer/GeoJSONLayer.js +1 -0
  26. package/src/layer/GridLayer.js +21 -0
  27. package/src/layer/LabelLayer.js +1 -0
  28. package/src/legend/ColorCategoryLegend.js +1 -0
  29. package/src/legend/ColorDiscreteLegend.js +2 -0
  30. package/src/legend/ColorLegend.js +1 -0
  31. package/src/legend/OrientationLegend.js +1 -0
  32. package/src/legend/SizeLegend.js +4 -2
  33. package/src/style/CompositionStyle.js +1 -0
  34. package/src/style/ContourStyle.js +1 -0
  35. package/src/style/DotDensityStyle.js +1 -0
  36. package/src/style/IsoFenceStyle.js +24 -72
  37. package/src/style/JoyPlotStyle.js +1 -1
  38. package/src/style/LegoStyle.js +22 -24
  39. package/src/style/MosaicStyle.js +1 -0
  40. package/src/style/NinjaStarStyle.js +1 -1
  41. package/src/style/PillarStyle.js +1 -0
  42. package/src/style/SegmentStyle.js +1 -0
  43. package/src/style/ShapeColorSizeStyle.js +1 -0
  44. package/src/style/SideCategoryStyle.js +1 -0
  45. package/src/style/SideStyle.js +51 -28
  46. package/src/style/SquareColorCategoryWebGLStyle.js +4 -3
  47. package/src/style/SquareColorWebGLStyle.js +1 -0
  48. package/src/style/StrokeStyle.js +1 -1
  49. package/src/style/TanakaStyle.js +11 -5
  50. package/src/style/TextStyle.js +1 -1
  51. package/src/style/TimeSeriesStyle.js +1 -0
  52. package/src/utils/scale.js +44 -18
  53. package/src/utils/stretching.js +4 -0
  54. package/src/utils/utils.js +2 -1
package/README.md CHANGED
@@ -9,13 +9,12 @@
9
9
  </p>
10
10
 
11
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://eurostat.github.io/gridviz/docs/reference). Unlike traditional raster-based web mapping tools, Gridviz renders everything client-side, on the fly.
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
13
 
14
14
  ## Styles
15
15
 
16
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
17
 
18
-
19
18
  [<img src="docs/img/overviews/ov_accessibility.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#shapecolorsize-style)
20
19
  [<img src="docs/img/overviews/ov_side_cat.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#side-category-style)
21
20
  [<img src="docs/img/overviews/ov_age_balance.png" width="70" height="70">](https://eurostat.github.io/gridviz/docs/reference#shapecolorsize-style)
@@ -31,11 +30,11 @@
31
30
 
32
31
  ## Live Demos
33
32
 
34
- - [Europe - 1km resolution - GEOSTAT/GISCO](https://eurostat.github.io/gridviz/examples/EUR.html)
35
- - [Germany - 100m resolution - Zensus 2011](https://eurostat.github.io/gridviz/examples/DE.html)
36
- - [France - 200m resolution - INSEE Filosofi](https://eurostat.github.io/gridviz/examples/FR.html). Focus on [total population](https://eurostat.github.io/gridviz/examples/FR_pop.html) and [income](https://eurostat.github.io/gridviz/examples/FR_income.html).
37
- - [Norway - 250m resolution - SSB](https://eurostat.github.io/gridviz/examples/NO.html)
38
- - [Croatia - 1km resolution - DZS 2015 grid](https://eurostat.github.io/gridviz/examples/HR.html)
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)
39
38
  - [France population, dark style](https://eurostat.github.io/gridviz/examples/styles/squarecolorwgl_dark.html)
40
39
  - [Europe population as a mosaic](https://eurostat.github.io/gridviz/examples/styles/mosaic_full.html)
41
40
 
@@ -56,7 +55,7 @@ import * as gridviz from 'gridviz'
56
55
  Or you can cherry-pick only the modules that you need, for example:
57
56
 
58
57
  ```javascript
59
- import { App, SquareColorWGLStyle } from 'gridviz'
58
+ import { Map, SquareColorWebGLStyle } from 'gridviz'
60
59
  ```
61
60
 
62
61
  ### Basic example
@@ -64,25 +63,27 @@ import { App, SquareColorWGLStyle } from 'gridviz'
64
63
  Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
65
64
 
66
65
  ```javascript
67
- let map = new gridviz.Map(containerDiv)
68
- //set position and zoom
69
- .setView(4500000, 2900000, 3000)
70
- //add CSV layer
71
- .addCSVGridLayer(
72
- //data URL
73
- 'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_5km.csv',
74
- //resolution, in CRS unit (m)
75
- 5000,
76
- //the style
77
- [
78
- new gridviz.SquareColorWGLStyle({
79
- //the CSV column to show
80
- colorCol: 'Population',
81
- //value to [0,1] mapping function
82
- tFun: (value) => gridviz.sExp(Math.min(value / 100000, 1), -15),
83
- }),
84
- ]
85
- )
66
+ //define map with initial view
67
+ const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
68
+
69
+ //define dataset
70
+ const dataset = new gridviz.CSVGrid(map, "https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_10km.csv", 10000)
71
+
72
+ //define color for each cell
73
+ const colorFunction = (cell) => {
74
+ if (cell.population > 150000) return "#993404"
75
+ else if (cell.population > 60000) return "#d95f0e"
76
+ else if (cell.population > 20000) return "#fe9929"
77
+ else if (cell.population > 6000) return "#fec44f"
78
+ else if (cell.population > 1500) return "#fee391"
79
+ else return "#ffffd4"
80
+ }
81
+
82
+ //define style
83
+ const style = new gridviz.ShapeColorSizeStyle({ color: colorFunction })
84
+
85
+ //add layer to map
86
+ map.layers = [new gridviz.GridLayer(dataset, [style])]
86
87
  ```
87
88
 
88
89
  See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference)** for more information.
@@ -95,7 +96,9 @@ See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference
95
96
 
96
97
  ## Documentation
97
98
 
98
- See the **[gridviz documentation page](https://github.com/eurostat/gridviz/blob/master/docs/reference.md)**.
99
+ See the **[gridviz documentation page](./docs/reference.md)**.
100
+
101
+ The document of [the previous version 2](./docs/reference_v2.md).
99
102
 
100
103
  ## Grid tiling
101
104
 
@@ -103,12 +106,12 @@ In order to visualize large grids efficiently, you can produce tiled grids in a
103
106
 
104
107
  ## About
105
108
 
106
- | | |
107
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
109
+ | | |
110
+ | -------------- | ----------- |
108
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) |
109
- | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
110
- | _status_ | Since 2020 |
111
- | _license_ | [EUPL 1.2](LICENSE) |
112
+ | _version_ | See [npm](https://www.npmjs.com/package/gridviz?activeTab=versions) |
113
+ | _status_ | Since 2020 |
114
+ | _license_ | [EUPL 1.2](LICENSE) |
112
115
 
113
116
  ### Support and contribution
114
117