Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serve multiple mbtiles with docker #323

Open
ghost opened this issue Oct 18, 2018 · 6 comments
Open

serve multiple mbtiles with docker #323

ghost opened this issue Oct 18, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Oct 18, 2018

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
Copy link
Contributor

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
Copy link
Author

ghost commented Oct 22, 2018

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

@spatialillusions
Copy link
Contributor

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
Copy link
Author

ghost commented Oct 23, 2018

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
Copy link
Contributor

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
Copy link
Author

ghost commented Nov 3, 2018

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 !

disarticulate added a commit to disarticulate/tileserver-gl that referenced this issue Apr 24, 2019
Empty tile warning details; definitely what you would expect if there's not a catastrophic error, but you're getting blank tiles.

such as: ```
MBTiles error, serving empty { Error: SQLITE_CORRUPT: database disk image is malformed
lily_tile_server |     at Error (native) errno: 11, code: 'SQLITE_CORRUPT' }

```
maptiler#323
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant