Skip to content

Commit 682814d

Browse files
committed
Extract symbology styles to own files
1 parent a203b1a commit 682814d

File tree

6 files changed

+153
-95
lines changed

6 files changed

+153
-95
lines changed

packages/schema/src/schema/project/layers/vectorLayer.json

Lines changed: 2 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -9,110 +9,17 @@
99
"type": "string",
1010
"description": "The id of the source"
1111
},
12-
"color": {
13-
"type": "object",
14-
"description": "The color of the the object"
15-
},
1612
"opacity": {
1713
"type": "number",
18-
"description": "The opacity of the the object",
14+
"description": "The opacity of the layer",
1915
"default": 1,
2016
"multipleOf": 0.1,
2117
"minimum": 0,
2218
"maximum": 1
2319
},
2420
"symbology": {
2521
"type": "object",
26-
"description": "The state of the layer's symbology options",
27-
"required": [],
28-
"additionalProperties": false,
29-
"properties": {
30-
"color": {
31-
"type": "object",
32-
"description": "The state of the layer's color symbology options",
33-
"required": ["renderType"],
34-
"properties": {
35-
"renderType": {
36-
"type": "string",
37-
"enum": ["Single Symbol", "Graduated", "Categorized", "Canonical", "Heatmap"]
38-
},
39-
"selectedAttribute": {
40-
"type": "string",
41-
"title": "Attribute",
42-
"description": "The selected attribute for varying the color",
43-
},
44-
"colorRamp": {
45-
"type": "string",
46-
"default": "cool"
47-
},
48-
"nStops": {
49-
"type": "number",
50-
"description": "The number of segments to use when mapping colors to data values",
51-
"default": 9
52-
},
53-
"stopsDistributionMode": {
54-
"type": "string",
55-
"description": "The method of distributing segments when mapping colors to data values",
56-
"default": "equal interval",
57-
"enum": [
58-
"quantile",
59-
"equal interval",
60-
"jenks",
61-
"pretty",
62-
"logarithmic"
63-
]
64-
},
65-
"strokeColor": {
66-
"type": "string",
67-
"description": "The color of the stroke for the symbol",
68-
"default": "#ffffff"
69-
}
70-
}
71-
},
72-
"size": {
73-
"type": "object",
74-
"description": "The state of the layer's size symbology options (radius, line thickness etc.)",
75-
"required": ["renderType"],
76-
"properties": {
77-
"renderType": {
78-
"type": "string",
79-
"enum": ["Single Symbol", "Graduated", "Canonical", "Categorized"]
80-
},
81-
"selectedAttribute": {
82-
"type": "string",
83-
"description": "The selected attribute for varying the size",
84-
},
85-
"nStops": {
86-
"type": "number",
87-
"description": "The number of segments to use when mapping colors to data values",
88-
"default": 9
89-
},
90-
"stopsDistributionMode": {
91-
"type": "string",
92-
"description": "The method of distributing segments when mapping colors to data values",
93-
"default": "equal interval",
94-
"enum": [
95-
"quantile",
96-
"equal interval",
97-
"jenks",
98-
"pretty",
99-
"logarithmic"
100-
]
101-
},
102-
"strokeThickness": {
103-
"type": "number",
104-
"description": "The thickness of the stroke in pixels",
105-
"default": 1.25
106-
},
107-
"symbolRadius": {
108-
"type": "number",
109-
"description": "The radius of the symbols in pixels",
110-
"default": 1
111-
}
112-
},
113-
"additionalProperties": false
114-
}
115-
}
22+
"description": "The user inputs for symbology options"
11623
}
11724
}
11825
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "object",
3+
"description": "The state of the GeoTiff layer's multiband coloring symbology options",
4+
"required": [],
5+
"additionalProperties": false,
6+
"properties": {
7+
"red": {
8+
"type": "string",
9+
"description": "The name of the band used for the red channel."
10+
},
11+
"green": {
12+
"type": "string",
13+
"description": "The name of the band used for the green channel."
14+
},
15+
"blue": {
16+
"type": "string",
17+
"description": "The name of the band used for the blue channel."
18+
},
19+
"alpha": {
20+
"type": "string",
21+
"description": "The name of the band used for the alpha channel."
22+
}
23+
}
24+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"type": "object",
3+
"description": "The state of the GeoTiff layer's single band coloring symbology options",
4+
"required": [],
5+
"additionalProperties": false,
6+
"properties": {
7+
"band": {
8+
"type": "string",
9+
"description": "The name of the band used for coloring."
10+
}
11+
}
12+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"type": "object",
3+
"description": "The state of the layer's color symbology options (fill color, stroke color etc.)",
4+
"required": ["renderType"],
5+
"additionalProperties": false,
6+
"properties": {
7+
"renderType": {
8+
"type": "string",
9+
"enum": ["Single Symbol", "Graduated", "Categorized", "Canonical", "Heatmap"]
10+
},
11+
"selectedAttribute": {
12+
"type": "string",
13+
"title": "Attribute",
14+
"description": "The selected attribute for varying the color"
15+
},
16+
"colorRamp": {
17+
"type": "string",
18+
"default": "cool"
19+
},
20+
"nStops": {
21+
"type": "number",
22+
"description": "The number of segments to use when mapping colors to data values",
23+
"default": 9
24+
},
25+
"stopsDistributionMode": {
26+
"type": "string",
27+
"description": "The method of distributing segments when mapping colors to data values",
28+
"default": "equal interval",
29+
"enum": [
30+
"quantile",
31+
"equal interval",
32+
"jenks",
33+
"pretty",
34+
"logarithmic"
35+
]
36+
},
37+
"stopsValues": {
38+
"type": "object",
39+
"description": "The mapping of input data values to size values",
40+
"patternProperties": {
41+
"^[0-9]+$": {
42+
"type": "string",
43+
"pattern": "^#[0-9a-fA-F]{6}$",
44+
"description": "The hex color value at the stop index, where the key is the index of the stop"
45+
}
46+
}
47+
},
48+
"strokeColor": {
49+
"type": "string",
50+
"description": "The color of the stroke for the symbol",
51+
"default": "#ffffff"
52+
}
53+
}
54+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"type": "object",
3+
"description": "The state of the layer's size symbology options (radius, line thickness etc.)",
4+
"required": ["renderType"],
5+
"additionalProperties": false,
6+
"properties": {
7+
"renderType": {
8+
"type": "string",
9+
"enum": ["Single Symbol", "Graduated", "Canonical", "Categorized"]
10+
},
11+
"selectedAttribute": {
12+
"type": "string",
13+
"description": "The selected attribute for varying the size"
14+
},
15+
"nStops": {
16+
"type": "number",
17+
"description": "The number of segments to use when mapping colors to data values",
18+
"default": 9
19+
},
20+
"stopsDistributionMode": {
21+
"type": "string",
22+
"description": "The method of distributing segments when mapping colors to data values",
23+
"default": "equal interval",
24+
"enum": [
25+
"quantile",
26+
"equal interval",
27+
"jenks",
28+
"pretty",
29+
"logarithmic"
30+
]
31+
},
32+
"stopsValues": {
33+
"type": "object",
34+
"description": "The mapping of input data values to size values",
35+
"patternProperties": {
36+
"^[0-9]+$": {
37+
"type": "number",
38+
"description": "The size value in pixels at the stop index, where the key is the index of the stop"
39+
}
40+
}
41+
},
42+
"strokeThickness": {
43+
"type": "number",
44+
"description": "The thickness of the stroke in pixels",
45+
"default": 1.25
46+
},
47+
"symbolRadius": {
48+
"type": "number",
49+
"description": "The radius of the symbols in pixels",
50+
"default": 1
51+
}
52+
}
53+
}

packages/schema/src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ export * from './_interface/project/layers/stacLayer';
2121
export * from './_interface/project/layers/vectorTileLayer';
2222
export * from './_interface/project/layers/webGlLayer';
2323

24+
// Symbology
25+
export * from './_interface/symbology/vectorColor';
26+
export * from './_interface/symbology/vectorSize';
27+
export * from './_interface/symbology/geotiffSingleband';
28+
export * from './_interface/symbology/geotiffMultiband';
29+
30+
2431
// Processing
2532
export * from './processing/_generated/exportProcessingSchema';
2633

2734
// exportLayer
2835
export * from './_interface/export/exportGeoJson';
2936
export * from './_interface/export/exportGeoTiff';
3037

38+
3139
// Other
3240
export * from './doc';
3341
export * from './index';

0 commit comments

Comments
 (0)