mid-tile

meta meta tiles

npm install mid-tile
4 downloads in the last month

mid-tile

A mid-level abstraction for making MBTiles from anything. Uses node-mbtiles for the hard parts, and makes things just easy enough, I hope.

complete example

This creates a tileset of tiles that just say their tile number as an image, using node-canvas.

var midTile = require('./');

var Canvas = require('canvas'),
    canvas = new Canvas(256, 256),
    ctx = canvas.getContext('2d');

midTile('myfile.mbtiles', {
    name: 'My File',
    bounds: [-179, -80, 179, 80]
}, function(xyz, mbtiles, cb) {
    ctx.fillStyle = '#fff';
    ctx.fillRect(0, 0, 256, 256);
    ctx.fillStyle = '#000';
    ctx.fillText(xyz.join('/'), 50, 50);
    mbtiles.putTile(
        xyz[0], xyz[1], xyz[2],
        canvas.toBuffer(), function(err) {
        cb();
    });
});
npm loves you