Skip to content

Commit c0c6b81

Browse files
authored
Add encoding field to vector sources (#1251)
* Add encoding field to vector sources * formatting * fix copy/paste error * Use integration instead of unit tests * apply review suggestions * Add issue references * remove comment * Adjust references to appease mkdocs * indicate existing support * add test case
1 parent a38f503 commit c0c6b81

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## main
22

33
### ✨ Features and improvements
4+
- Add optional `encoding` property to vector `source` to allow for MapLibre Tile vector sources
45
- _...Add new stuff here..._
56

67
### 🐞 Bug fixes

src/reference/v8.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,31 @@
364364
}
365365
}
366366
},
367+
"encoding": {
368+
"type": "enum",
369+
"values": {
370+
"mvt": {
371+
"doc": "Mapbox Vector Tiles. See http://github.com/mapbox/vector-tile-spec for more info."
372+
},
373+
"mlt": {
374+
"doc": "MapLibre Vector Tiles. See https://github.com/maplibre/maplibre-tile-spec for more info."
375+
}
376+
},
377+
"default": "mvt",
378+
"doc": "The encoding used by this source. Mapbox Vector Tiles encoding is used by default.",
379+
"sdk-support": {
380+
"mvt": {
381+
"android": "supported",
382+
"ios": "supported",
383+
"js": "supported"
384+
},
385+
"mlt": {
386+
"android": "https://github.com/maplibre/maplibre-native/issues/3721",
387+
"ios": "https://github.com/maplibre/maplibre-native/issues/3721",
388+
"js": "https://github.com/maplibre/maplibre-gl-js/issues/6258"
389+
}
390+
}
391+
},
367392
"*": {
368393
"type": "*",
369394
"doc": "Other keys to configure the data source."

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,47 @@
6464
"tiles": ["http://example.com/{x}/{y}/{z}.png"],
6565
"valueOf": null,
6666
"toLocaleString": 6
67+
},
68+
"source-vector-default": {
69+
"type": "vector",
70+
"url": "https://demotiles.maplibre.org/tiles/tiles.json"
71+
},
72+
"source-vector-mvt": {
73+
"type": "vector",
74+
"url": "https://demotiles.maplibre.org/tiles/tiles.json",
75+
"encoding": "mvt"
76+
},
77+
"source-vector-mlt-tilejson": {
78+
"type": "vector",
79+
"url": "https://demotiles.maplibre.org/tiles/tiles.json",
80+
"encoding": "mlt"
81+
},
82+
"source-vector-mlt-tiles": {
83+
"type": "vector",
84+
"url": "https://demotiles.maplibre.org/tiles/tiles/{z}/{x}/{y}.mlt",
85+
"encoding": "mlt"
86+
},
87+
"source-vector-custom": {
88+
"type": "vector",
89+
"url": "https://demotiles.maplibre.org/tiles/tiles.json",
90+
"encoding": "custom"
91+
},
92+
"source-vector-blank": {
93+
"type": "vector",
94+
"url": "https://demotiles.maplibre.org/tiles/tiles.json",
95+
"encoding": ""
96+
},
97+
"source-vector-numeric": {
98+
"type": "vector",
99+
"url": "https://demotiles.maplibre.org/tiles/tiles.json",
100+
"encoding": 3
101+
},
102+
"source-vector-array": {
103+
"type": "vector",
104+
"url": "https://demotiles.maplibre.org/tiles/tiles.json",
105+
"encoding": [
106+
"mvt"
107+
]
67108
}
68109
},
69110
"layers": []

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,21 @@
3838
{
3939
"message": "sources.cluster-properties.state.map: \"zoom\" and \"feature-state\" expressions are not supported with cluster properties.",
4040
"line": 50
41+
},
42+
{
43+
"message": "sources.source-vector-custom.encoding: expected one of [mvt, mlt], \"custom\" found",
44+
"line": 90
45+
},
46+
{
47+
"message": "sources.source-vector-blank.encoding: expected one of [mvt, mlt], \"\" found",
48+
"line": 95
49+
},
50+
{
51+
"message": "sources.source-vector-numeric.encoding: expected one of [mvt, mlt], 3 found",
52+
"line": 100
53+
},
54+
{
55+
"message": "sources.source-vector-array.encoding: expected one of [mvt, mlt], [\"mvt\"] found",
56+
"line": 105
4157
}
4258
]

0 commit comments

Comments
 (0)