5

What is/are the best way(s) to host mbtiles?

I have tried:

  • hosting on my own server with tileserver.php: this works and is very straighforward and simple to set up, but doesn't seem to be super fast (maybe a problem with my server) and I fear that when the site opens to the world it will simply break down; (also, tileserver.php sends HTTP error 500 when a tile isn't found, which I find misleading?)
  • hosting on S3 (1 tile per S3 object): serving tiles is very efficient and fast, but uploading to S3 using tilecloud always raises an S3 error "connection reset by peer" in the middle of the process, so uploading never ends properly and more than half the tiles are not sent (and it seems that trying again just restarts everything from the beginning)

MapBox would be the obvious choice but their prices seem very high?

The mbtiles file is under 500 Mo for zoom levels [9,15], gets to 1 Go for levels [9,16] and 2.7 Go for levels [9,17]; I can live with [9,15].

S3 would be the simplest for me, if I can find a way to upload all tiles without error (or, with an error that can be debugged: S3 logging doesn't show anything for the error I'm experiencing).

Any other idea?

5

The best solution for hosting MBTiles depends on the scale. The solution for 10000 tile requests per month can be very different than the best solution for handling tens or hundreds of requests per second, but S3 works pretty well for both.

S3 can be much cheaper than MapBox if your hosting your own data and not using any of their rendering. At large enough scale S3 can start to be expensive, and it can be much cheaper to serve tiles from a VPS.

I upload a lot of tiles to s3, and my current solution is to launch a small or micro ec2 instance in the aws region the bucket is in(usually US-east), copy the MBTiles file to it with scp, then extract the tiles with MBUtil, and upload them with s3cmd. If you do this it can be handy to create an AMI all setup for this purpose, then just launch it when you need it.

Update 9/2017 I've written a utility for uploading tiles from an MBTiles file to s3 in parallel, using 100 threads im able to upload about 500 tiles per second. Script is available on github

  • Great idea to upload the mbtiles file to EC2 and do the export from within the instance! Thanks! – Bambax Mar 17 '14 at 12:34
  • 3
    if you are in 9/2017, can you tell me if the US president is a woman ? – JulienFr Oct 1 '16 at 21:59
  • I'm also looking for a solution for hosting mbtiles. I'm no so familiar with S3 but what is the advantage of using a EC2 for converting the .mbtiles instead of converting them locally and uploading the generated folders instead? What would be the pros / cons of using a mbtile server e.g. npmjs.com/package/mbtiles-server ? – Jan Jan 21 '18 at 16:17
1

Hosting on Amazon S3 is extremely easy with MapTiler (http://www.maptiler.com), which includes an easy to use high-performance (=parallel) uploader for Amazon S3 and Google Cloud Storage. See this video: https://www.youtube.com/watch?v=A5gFXvxWIHM&list=PLGHe6Moaz52PiQd1mO-S9QrCjqSn1v-ay&index=9

In case you want to host MBTiles (including interactivity, etc) on your own PHP hosting - you could also try the open-source project https://github.com/klokantech/tileserver-php/. A video tutorial is here: https://www.youtube.com/watch?v=F6MvDvc5m-I&list=PLGHe6Moaz52PiQd1mO-S9QrCjqSn1v-ay&index=2

Both of these hosting approaches will provide you also with OGC WMTS compatibility, and sample viewers - so the maps can be easily reused in various GIS tools to JavaScript mapping libraries such as Google Maps API, Leaflet or OpenLayers.

  • 2
    Maybe an explicit disclosure statement would be applicable here. – BradHards Jul 20 '15 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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