I'm generating a few mbtiles
with TileMaker, using the exact same configuration:
- test1.mbtiles
- test2.mbtiles
Those tiles have a source-layer=poi
.
I would like to serve them, without merging them beforehand (as I'm planning to have a mbtiles/country) with tileserver-gl, using maplibre-gl-js.
For that, I'm using a style.json
that will eventually contains a bunch of layers, with some layers based on the POIs:
{
"version": 8,
"name": "OSM Bright",
"layers": [
{
"id": "poi_z15",
"type": "symbol",
"source": "tests",
"source-layer": "poi",
"minzoom": 15,
xxxxx,
},
{
"id": "poi_z16",
"type": "symbol",
"source": "tests",
"source-layer": "poi",
"minzoom": 16,
xxxxx,
},
Those layers, are based on "source-layer": "poi"
and should work for both mbtiles (test1 and test2). The problem is that the layer definition requests a source
, that I've tagged "source": "tests"
in this example.
How, in this style, do you link both mbtiles ? If I do
...
"sources": {
"tests": {
"type": "vector",
"url": "mbtiles://test1.mbtiles"
},
...
It will work for the mbtiles test1. Now if I want to add the second mbtiles test2, the only way I've found so far is to create a new source, hence my style would become
...
"sources": {
"test1": {
"type": "vector",
"url": "mbtiles://test1.mbtiles"
},
"test2": {
"type": "vector",
"url": "mbtiles://test2.mbtiles"
},
...
and in that case I need to duplicate my layers as:
{
...
"layers": [
{
"id": "poi_z15",
"type": "symbol",
"source": "test1",
"source-layer": "poi",
"minzoom": 15,
xxxxx,
},
{
"id": "poi_z16",
"type": "symbol",
"source": "test1",
"source-layer": "poi",
"minzoom": 16,
xxxxx,
},
{
"id": "poi_z15",
"type": "symbol",
"source": "test2",
"source-layer": "poi",
"minzoom": 15,
xxxxx,
},
{
"id": "poi_z16",
"type": "symbol",
"source": "test2",
"source-layer": "poi",
"minzoom": 16,
xxxxx,
},
If I have 100 mbtiles, it would mean that I would need to duplicate 100 times those layers specifications.
Is there a way to do something like:
...
"sources": {
"tests": [{
"type": "vector",
"url": "mbtiles://test1.mbtiles"
},
{
"type": "vector",
"url": "mbtiles://test2.mbtiles"
}]
...
or
...
"sources": {
"tests": {
"type": "vector",
"url": ["mbtiles://test1.mbtiles", "mbtiles://test2.mbtiles"]
}
...
Obviously both solutions above don't work. Thanks in advance for your feedbacks!