Skip to content

Commit ba751f4

Browse files
Validate that raster layers do not specify both 'resampling' and 'raster-resampling' (#1532)
* Invalidate if 'resampling' and 'raster-resampling' * Add CHANGELOG entry * chore(fmt): apply pre-commit formatting fixes * Fix PR link in CHANGELOG * Update resampling sdk-support for JS to v5.20.0* *Upcoming release --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8d85feb commit ba751f4

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## main
22
### ✨ Features and improvements
3+
- Validate that `raster` layers do not specify both `resampling` and `raster-resampling` paint properties ([#1532](https://github.com/maplibre/maplibre-style-spec/pull/1532)) (by [larsmaxfield](https://github.com/larsmaxfield))
34
- _...Add new stuff here..._
45

56
### 🐞 Bug fixes

src/reference/v8.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7763,7 +7763,7 @@
77637763
"default": "linear",
77647764
"sdk-support": {
77657765
"basic functionality": {
7766-
"js": "https://github.com/maplibre/maplibre-gl-js/issues/7154",
7766+
"js": "5.20.0",
77677767
"android": "https://github.com/maplibre/maplibre-native/issues/4117",
77687768
"ios": "https://github.com/maplibre/maplibre-native/issues/4117"
77697769
}
@@ -8050,7 +8050,7 @@
80508050
"default": "linear",
80518051
"sdk-support": {
80528052
"basic functionality": {
8053-
"js": "https://github.com/maplibre/maplibre-gl-js/issues/7154",
8053+
"js": "5.20.0",
80548054
"android": "https://github.com/maplibre/maplibre-native/issues/4117",
80558055
"ios": "https://github.com/maplibre/maplibre-native/issues/4117"
80568056
}
@@ -8128,7 +8128,7 @@
81288128
"default": "linear",
81298129
"sdk-support": {
81308130
"basic functionality": {
8131-
"js": "https://github.com/maplibre/maplibre-gl-js/issues/7154",
8131+
"js": "5.20.0",
81328132
"android": "https://github.com/maplibre/maplibre-native/issues/4117",
81338133
"ios": "https://github.com/maplibre/maplibre-native/issues/4117"
81348134
}

src/validate/validate_layer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ export function validateLayer(options) {
144144
}
145145
}
146146

147+
if (type === 'raster' && layer.paint?.resampling && layer.paint?.['raster-resampling']) {
148+
errors.push(
149+
new ValidationError(
150+
key,
151+
layer.paint,
152+
`layer "${layer.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`
153+
)
154+
);
155+
}
156+
147157
errors = errors.concat(
148158
validateObject({
149159
key,

test/integration/style-spec/tests/layers.input.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@
190190
"hillshade-highlight-color": [],
191191
"hillshade-shadow-color": []
192192
}
193+
},
194+
{
195+
"id": "redundant-resampling",
196+
"type": "raster",
197+
"source": "raster",
198+
"source-layer": "source-layer",
199+
"paint": {
200+
"resampling": "nearest",
201+
"raster-resampling": "linear"
202+
}
193203
}
194204
]
195205
}

test/integration/style-spec/tests/layers.output.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,9 @@
102102
{
103103
"message": "layers[22].paint.hillshade-shadow-color: array length at least 1 expected, length 0 found",
104104
"line": 191
105+
},
106+
{
107+
"message": "layers[23]: layer \"redundant-resampling\" redundantly specifies \"resampling\" and \"raster-resampling\" paint properties, but only one is allowed. It is advised to use \"resampling\".",
108+
"line": 199
105109
}
106110
]

0 commit comments

Comments
 (0)