QGIS – Serving MBtiles for Cesium Consumption

cesiumjavascriptmbtilesqgis

I am trying to create custom mbtile for Cesium consumption.

I was able to create a mbtiles file in QGIS (zoom 0 to 16) using the QTiles plug-in. I tested the generated mbtiles file using mbviewer from mapbox and it worked fine. mbviewer

node cli.js --port 9000 ~/tmp/starpeak_low_res.mbtiles Listening on http://localhost:9000

So to serve it to Cesium, I used mbtiles-server from npm to create a WMTS compatible server. Here is the link to the server mbtiles-server

So in Cesium, all I had to do is add a a new imagery provider:

var high_res = layers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
    url : 'http://10.10.3.13:8030/starpeak_low_res/wmts',
    layer : 'starpeak_low_res',
    style: 'default',
    format : 'image/jpeg',
    tileMatrixSetID : 'GoogleMapsCompatible',
    maximumLevel: 16
}));

however, it takes a very very very long time for the images to load on Cesium but it's almost instant using mbviewer. The mbtiles file is 200 MB but I assume at different zoom levels only a portion of that file is fetched.

Just to make sure the issue is not with mbtiles-server, I downloaded the free low res sattelite mbtiles files from openmaptiles link here. link. That mbtiles file is served fine it's instant loading at different zoom levels.

for reference I uploaded the mbtiles file here. Credits to NAIP GEOTIFF from earthexplorer.usg.gov generated mbtiles file

Best Answer

Use XYZ Tile Server instead of WMTS. I use several different one's depending on the platform. You can also skip the tile server and upload folder of tiles to S3 Bucket or Standard Wed Server. http://someurl/Z/X/Y.png. https://github.com/naturalatlas/tilestrata or https://github.com/mojodna/tessera

Related Question