change interface to XYZ
This commit is contained in:
@@ -268,7 +268,7 @@ MBTiles.prototype.insertGridTiles = function(map, callback) {
|
|||||||
stmt.finalize(callback);
|
stmt.finalize(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Select a tile from an mbtiles database.
|
// Select a tile from an mbtiles database. Scheme is XYZ.
|
||||||
//
|
//
|
||||||
// - @param {Number} x tile x coordinate.
|
// - @param {Number} x tile x coordinate.
|
||||||
// - @param {Number} y tile y coordinate.
|
// - @param {Number} y tile y coordinate.
|
||||||
@@ -277,6 +277,9 @@ MBTiles.prototype.insertGridTiles = function(map, callback) {
|
|||||||
MBTiles.prototype.getTile = function(z, x, y, callback) {
|
MBTiles.prototype.getTile = function(z, x, y, callback) {
|
||||||
if (typeof callback !== 'function') callback = noop;
|
if (typeof callback !== 'function') callback = noop;
|
||||||
|
|
||||||
|
// Flip Y coordinate because MBTiles files are TMS.
|
||||||
|
y = Math.pow(2, z) - 1 - y;
|
||||||
|
|
||||||
var mbtiles = this;
|
var mbtiles = this;
|
||||||
this.db.get('SELECT tile_data FROM tiles WHERE ' +
|
this.db.get('SELECT tile_data FROM tiles WHERE ' +
|
||||||
'zoom_level = ? AND tile_column = ? AND tile_row = ?',
|
'zoom_level = ? AND tile_column = ? AND tile_row = ?',
|
||||||
@@ -297,7 +300,7 @@ MBTiles.prototype.getTile = function(z, x, y, callback) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Select a grid and its data from an mbtiles database.
|
// Select a grid and its data from an mbtiles database. Scheme is XYZ.
|
||||||
//
|
//
|
||||||
// - @param {Number} x tile x coordinate
|
// - @param {Number} x tile x coordinate
|
||||||
// - @param {Number} y tile y coordinate
|
// - @param {Number} y tile y coordinate
|
||||||
@@ -306,6 +309,9 @@ MBTiles.prototype.getTile = function(z, x, y, callback) {
|
|||||||
MBTiles.prototype.getGrid = function(z, x, y, callback) {
|
MBTiles.prototype.getGrid = function(z, x, y, callback) {
|
||||||
if (typeof callback !== 'function') callback = noop;
|
if (typeof callback !== 'function') callback = noop;
|
||||||
|
|
||||||
|
// Flip Y coordinate because MBTiles files are TMS.
|
||||||
|
y = Math.pow(2, z) - 1 - y;
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
Step(
|
Step(
|
||||||
function() {
|
function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user