6

My main processing machine is a Ubuntu box running 14.04 with PostGIS and TileMill. I generated my tiles and the resulting mbtiles export is about 250MB (megs, not gigs). The PI runs python, has a storage card big enough to keep the mbtiles export, and wifi. At most, I might have 2-3 devices accessing the endpoint requesting tiles. Typically, only one device will be requesting tiles.

Keeping in mind, I prefer simplicity with minimal hardware requirements over a feature-rich server, what are my options for serving up the tiles from the mbtiles with a PI 2?

  • So no new tiles on the fly? Just periodic update via a new mbtiles generation (or no update at all)? – BradHards Feb 20 '15 at 21:43
  • @BradHards updates will be periodic via new mbtiles file – DenaliHardtail Feb 20 '15 at 21:48
3

Based on available documentation, it sounds like you need to :

  1. Install a webserver on the Pi, like Apache
  2. Place the tiles (which you said you've already generated) into a known directory structure within your web server.
  3. Per the previously link: Change the OpenLayers instance to use your own tileserver instead of the main one

The link in the 2nd point offers alternatives to using a webserver. There was a Ruby/Python implementation which may also suffice.

  • But the question was about serving tiles from a mbtiles database file not from directory structure. – user30184 Feb 22 '15 at 8:47
2

From what you've described, a simple option would be to use Tilestache. It supports mbtiles natively, so you don't need to unpack them. That is good for maintenance purposes, and can save space because of the view idea I described in a comment on another of your questions.

There are at least three ways to serve tiles with Tilestache. I'd go with the first of those (i.e. run tilestache-server.py with an appropriate config file, don't worry about finding another WSGI server like gunicorn unless you already have it running somewhere). The other options are also valid if you'd prefer to use an alternative approach for reasons not described in your question (e.g. needing to share the PI2 resources).

An alternative to Tilestache would be tilestream. Its also able to work natively with mbtiles. Tilestream is probably higher performance than Tilestache (although I haven't compared them), but it is probably overkill for what you've described. Tilestream is perhaps better if you want something you can hack on and prefer nodejs to python.

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.