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.12k stars 613 forks source link

Serving multiple maps (.MBTiles) in th same server. #1209

Open fr111 opened 3 months ago

fr111 commented 3 months ago

Hello everyone,

I'm trying to serve multiple maps in my tileserver-gl server free version deployed in Linux Ubuntu 22.04 but unfortunately I just can serve one. My maps are in the folder /data but the server just reads the first one (alphabetic order). I already made a lot of changes in the file style/config.json and in the file /build/style/style.json. My server is being deployed with docker containers. I have two .mbtiles with different maps. I want to access them using QGIS desktop. I can access one but the second one the system simple does not read it. It's enough just to make changes in config.json or I need to make changes also in style.json? Can you provide me an example? Why the system just reads the first map?

Thank you.

Regards,

FR

acalcutt commented 3 months ago

Without a config and no mbtiles files specified, tileserver-gl just picks the first mbtiles file in the directory. It sounds like you have an issue where it is not using your config file and is just picking up the first mbtiles file.

When using docker, typically you have a local folder set up. it looks like in your case that is 'build', so it would look something like this (it doesn't need to be exactly like this, it is just an example)

/build/config.json
/build/fonts/
/build/styles/stylename/style.json
/build/sprites 

If you look at the second example at https://github.com/maptiler/tileserver-gl?tab=readme-ov-file#getting-started-with-docker you can see an example of this structure at https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/test_data.zip

In the example command docker run --rm -it -v $(pwd):/data -p 8080:8080 maptiler/tileserver-gl $(pwd) is the local folder that is being mapped to /data inside the docker machine. You can either browse to your /build path before running this command, or change the command to docker run --rm -it -v /build:/data -p 8080:8080 maptiler/tileserver-gl by default, tileserver-gl is looking for a config.json in your root path, wich is /data, and /data maps to what is inside your local /build folder

You could also tell tileserver-gl the path to your config file, you just what to remember inside the docker all your paths start with /data , so if your config is in style/config.json , you can specy the config location with -c docker run --rm -it -v /build:/data -p 8080:8080 maptiler/tileserver-gl -c /data/style/config.json

In my own server at tiles.wifidb.net, I use a config like this https://github.com/acalcutt/wifidb-tileserver-gl/blob/master/tileserver-gl/configs/config-pmtiles.json (note though I am not using docker here, so my paths are a little different that what you will need)

Don't forget to check out the documentation at https://maptiler-tileserver.readthedocs.io/en/latest/config.html

fr111 commented 3 months ago

Hello Acalcutt,

hope you are well.

Thank you very much for your explanation.

Regards FR