tiler-mbtiles
v0.1.1
Published
A map tile reader for mapbox mbtiles
Downloads
3
Readme
tiler-mbtiles
A nodejs map tile reader for mapbox mbtiles format.
Introduction
This is a map tile file reader for mapbox's mbtiles in XYZ schema.
This link introduces what is mbtiles.
Developed based on mapbox's node-mbtiles
The test is based on the test materials from node-mbtiles.
See Also
tiler-xyz: A nodejs map tile file reader coordinating by X,Y,Z
tiler-arcgis-xyz: A nodejs map tile reader for exploded tiles by ESRI ArcGIS
tiler-arcgis-compact: A nodejs map tile reader for compact tiles by ESRI ArcGIS
Install
npm install tiler-mbtiles
Usage
var Tiler = require('tiler-mbtiles');
//path of the mbtiles file
//because it needs time to load mbtiles, the callback will be called when the tiler is ready
var tiler = new Tiler(__dirname+'/test/plain_1.mbtiles', function(error) {
if (error) {
throw error;
}
tiler.getTile(0, 0, 1, function(error, tile) {
if (error) {
throw error;
}
assert.ok(tile);
assert.ok(!isNaN(Date.parse(tile.lastModified)));
fs.writeFileSync('1_0_0.png', tile.data);
});
});
//An error will be thrown because the tiler is not ready.
//tiler.getTile(..)