5

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

1 Answer 1

1

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

7
  • Try an existing XYZ Tile server to see the performance. Use the Leaflet Providers to grab the URL of the Tile Servers leaflet-extras.github.io/leaflet-providers/preview for Example ESRI server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/…{z}/{y}/{x}.png or one of my favorite tile.stamen.com/terrain{z}/{x}/{y}.jpg Jun 8, 2018 at 20:19
  • Connect to XYZ tile Server via URL Template Imagery Provider cesiumjs.org/Cesium/Build/Documentation/… Jun 8, 2018 at 20:21
  • Why NOT use Terriajs instead of Cesium. It's easy to add layers via a JSON catalog file. It's based on Cesium Jun 8, 2018 at 20:21
  • ok I will try it with XYZ tile servers, but I wanted to use mbtiles to ease uploading of areas for users. Also I need to host it offline so cannot do S3. I looked at TerriaJS and it seems like it supports vector tiling which I think Cesium doesn't support. I will try that as well.
    – ArmenB
    Jun 8, 2018 at 20:41
  • Cesium and Terriajs ARE NOT offline Mapping Engines for Mobile Apps. They require a WebServer to run and a Tile Server to serve the MBTILES. You could build that as part of a mobile app webview. But you'd be better off selecting an OpenGL Powered Native Solution like WhirlyGlobe/Maply or MapBox GL Native or Mapbox GL React Native Jun 12, 2018 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.