maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.24k stars 639 forks source link

serve multiple mbtiles with docker #323

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi, So I'm using docker-compose for my maps server, I downloaded two file of mbtiles and

My docker-compose file is : version: '3.4' services: openmaptiles: image: klokantech/tileserver-gl ports: - 8080:80 volumes: - "./data:/data" command: "--verbose -c config.json"

My config.json file is :

{ "options": { "paths": { "root": "/usr/src/app/node_modules/tileserver-gl-styles", "fonts": "fonts", "styles": "styles", "mbtiles": "/data" } }, "styles": { "klokantech-basic": { "style": "klokantech-basic/style.json", "tilejson": { "bounds": [ 34.07929, 29.37711, 35.91531, 33.35091 ] } }, "osm-bright": { "style": "osm-bright/style.json", "tilejson": { "bounds": [ 34.07929, 29.37711, 35.91531, 33.35091 ] } }, "klokantech-basic-gb": { "style": "klokantech-basic/style.json", "tilejson": { "bounds": [ -9.408655, 49.00443, 2.25, 61.13564 ] } }, "osm-bright-gb": { "style": "osm-bright/style.json", "tilejson": { "bounds": [ -9.408655, 49.00443, 2.25, 61.13564 ] } } }, "sources": { "israel": { "url": "mbtiles://{v2}", "type": "vector" }, "greatBritain": { "url": "mbtiles://{v3}", "type": "vector" } }, "data": { "v2": { "mbtiles": "2017-07-03_asia_israel-and-palestine.mbtiles" }, "v3": { "mbtiles": "2017-07-03_europe_great-britain.mbtiles" } } }

But on server I can see only one of them, like, randomly one of them : server

As you can see, now it serves only GB map and other map does not exists.

what do i do wrong ?

Thank you !

spatialillusions commented 6 years ago

A bit unclear what you expect here. The four styles you have in your config are displayed as styles, and the two datasets are displayed under data. If you want to have separate maps over Israel, you will have to copy the styles and change them to use the {v2} source.

ghost commented 6 years ago

I want to serve both mbtiles, is it possible ? What you mean about change the styles to v2 source ?

spatialillusions commented 6 years ago

Copy the style files so that you get one version for gb and one for il. Update your config file to something like this:

{
"options": {
"paths": {
"root": "/usr/src/app/node_modules/tileserver-gl-styles",
"fonts": "fonts",
"styles": "styles",
"mbtiles": "/data"
}
},
"styles": {
"klokantech-basic": {
"style": "klokantech-basic/style-il.json",
"tilejson": {
"bounds": [ 34.07929, 29.37711, 35.91531, 33.35091 ]
}
},
"osm-bright": {
"style": "osm-bright/style-il.json",
"tilejson": {
"bounds": [ 34.07929, 29.37711, 35.91531, 33.35091 ]
}
},
"klokantech-basic-gb": {
"style": "klokantech-basic/style-gb.json",
"tilejson": {
"bounds": [ -9.408655, 49.00443, 2.25, 61.13564 ]
}
},
"osm-bright-gb": {
"style": "osm-bright/style-gb.json",
"tilejson": {
"bounds": [ -9.408655, 49.00443, 2.25, 61.13564 ]
}
}
},
"data": {
"israel": {
"mbtiles": "2017-07-03_asia_israel-and-palestine.mbtiles"
},
"greatbritain": {
"mbtiles": "2017-07-03_europe_great-britain.mbtiles"
}
}
}

in klokantech-basic/style-il.json and osm-bright/style-il.json replace

  "sources": {
    "openmaptiles": {
      "type": "vector",
      "url": "mbtiles://{v3}"
    }
  },

with

  "sources": {
    "openmaptiles": {
      "type": "vector",
      "url": "mbtiles://{israel}"
    }
  },

do the same for gb.

I haven't tested it but it should work.

ghost commented 6 years ago

I tried that, I'm getting :

openmaptiles_1 | Waiting 3 seconds for xvfb to start... openmaptiles_1 | Starting tileserver-gl v2.4.0 openmaptiles_1 | Using specified config file from config.json openmaptiles_1 | Starting server openmaptiles_1 | ERROR: data "v3" not found! docker_openmaptiles_1 exited with code 0

any help ?

thank you again

spatialillusions commented 6 years ago

Do you still have any styles that tries to read the source called "v3"? It should say {israel} and {greatbritain}, not {v3}, otherwise you will have to have a source called "v3".

ghost commented 6 years ago

Hi, Thank you. It works ! but, only with small mbtiles.

When I'm using file (like Europe) which is over 20GB, I get

Creating te_openmaptiles_1 ... done
Attaching to te_openmaptiles_1
openmaptiles_1  | Waiting 3 seconds for xvfb to start...
openmaptiles_1  | Starting tileserver-gl v2.4.0
openmaptiles_1  | Using specified config file from config.json
openmaptiles_1  | Starting server
openmaptiles_1  | Listening at http://[::]:80/
openmaptiles_1  | { Error: SQLITE_CORRUPT: database disk image is malformed
openmaptiles_1  |     at Error (native) errno: 11, code: 'SQLITE_CORRUPT' }
openmaptiles_1  | SQLITE_CORRUPT: database disk image is malformed
te_openmaptiles_1 exited with code 0

When I'm checking the file with PRAGMA integrity_check; I'm getting OK status.

Is there any limit of file size ??

Thank you once again !