Skip to content

Commit 7a78545

Browse files
authored
doc(MVA): 21304 Create readme for Multivariate_layer config. Update MVA config version from 0 to 1 (#1242)
1 parent edd51d5 commit 7a78545

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

src/core/logical_layers/renderers/MultivariateRenderer/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export type MultivariateStepOverrides = {
4141
};
4242

4343
export interface MultivariateLayerConfig {
44-
version: 0;
44+
version: 1;
4545
id: string;
4646
name: string;
4747
score?: MultivariateDimension;

src/features/multivariate_layer/helpers/createMultivariateConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function createMultivariateConfig(
107107
: undefined;
108108

109109
return {
110-
version: 0,
110+
version: 1,
111111
id: generateMultivariateId(name),
112112
name,
113113
score: scoreMCDAStyle,
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# MVA - Multivariate Analysis layer
2+
3+
MVA (Multivariate Analysis layer) - is a complex logical layer which can consist of several optional dimensions:
4+
5+
- `score`
6+
- `base` ("compare")
7+
- `text` ("label")
8+
- `opacity` ("hide area")
9+
- `extrusion` ("3D")
10+
11+
Depending on dimensions, several visual layers can be created on the map:
12+
13+
- fill layer, which can be have several color modes:
14+
- MCDA coloring (either `score` or `base` dimension is present). MCDA coloring is a linear gradient
15+
- Bivariate coloring (both `score` and `base` dimensions are present). Bivariate coloring uses a limited number of color classes, each with it's value range.
16+
- Monochrome coloring (neither `score` nor `base` dimensions are present; `opacity` or `extrusion` are present)
17+
- text layer
18+
- 3D (extrusion) layer
19+
- opacity (pseudolayer, applies to fill layer)
20+
21+
## How to use
22+
23+
To start using this feature user needs:
24+
25+
- feature flag "multivariate_layer" is turned on for current user
26+
27+
### Activation
28+
29+
In toolbar, user can click "Create analysis layer" (analysis creation dialog pops up) or "Upload analysis layer" (config file upload) button.
30+
31+
### JSON structure
32+
33+
See `MultivariateLayerConfig` type for up-to date details.
34+
35+
1. `version` - will be used for config versioning.
36+
2. `id` - id of the logical layer.
37+
3. `score` - Score dimension. Contains MCDA layer config. Final MCDA score a feature is used for coloring.
38+
4. `base` - Base (Compare) dimension. Contains MCDA layer config. Final MCDA score of a feature is used for coloring.
39+
5. `stepOverrides` - only used for bivariate coloring. Defines value ranges for bivariate colors
40+
6. `opacity` - Opacity dimension. Contains MCDA layer config. Final score is used to apply different levels of opacity to different features.
41+
7. `text` - Text (Label) dimension. Can either display text based on MCDA config or using MapLibre expression.
42+
43+
- `mcdaValue` - Contains MCDA layer config. The output depends on `mcdaMode`
44+
- `mcdaMode` property:
45+
- `score` - Single line of text (total MCDA score)
46+
- `layers` - One line of text for each of the MCDA axes (layers) in MCDA config
47+
- `expressionValue` - optional property, can contain MapLibre expression, for custom outputs and calculations. `mcdaValue` overwrites this.
48+
- `formatString` - optional string template. Replaces `{value}` and `{unit}` with MCDA axis value and unit accordingly. If not present, `{value} {unit}` template is used.
49+
- `precision` - optional, number. How many numbers is retained after the decimal point.
50+
- `paintOverrides` and `layoutOverrides` - optional, can be used to customize MapLibre paint and layer specification. See for more at [MapLibre Symbol layer style specification](https://maplibre.org/maplibre-style-spec/layers/#symbol)
51+
52+
8. `extrusion` - If present, extruded 3D shapes are rendered based for each of the features.
53+
54+
- `height` - Contains MCDA layer config. Final score is used to apply different height to different features.
55+
- `maxHeight` - number in meters. Defines the biggest height of 3D shape. `maxHeight` is the height of mcda score === `1`
56+
57+
9. `colors` - Defines colors used by fill layer. Can be either `BivariateColorConfig` or `MCDAColorConfig`
58+
10. `staticOpacity` - value in [0; 1] range. Can be used to make fill layer more transparent.
59+
60+
## MultivariateRenderer
61+
62+
Currently, the logic of creating all the physical Maplibre layers is contained in `src/core/logical_layers/renderers/MultivariateRenderer/MultivariateRenderer.tsx`.
63+
64+
## Further development notes
65+
66+
### MultivariateLayerConfig optimization
67+
68+
Generated MVA config currently contains a lot of unused/duplicated data, most of it in MCDA layer configs.
69+
70+
- `MultivariateDimension` type can be a `MCDAConfig` instead of `MCDALayerStyleConfig`
71+
- `colors` property from MCDAConfig is not used in MVA
72+
- `MCDAConfig` needs further optimizations
73+
- having `id` in `MCDAConfig` is questionable
74+
- `transformationFunction` and `transformation` properties in `MCDALayer`. `transformationFunction` is deprecated and contained within `transformation`, so it should be removed from root level.
75+
- `AxisTransformationWithPoints` - `points` array is only used to show debug MCDA values distribution chart.
76+
77+
### MVA creation dialog
78+
79+
More user-friendly creation dialog should to be implemented.

0 commit comments

Comments
 (0)