only list map records that include tile data in ZXYStream()

This commit is contained in:
Ryan Clark
2015-04-23 15:44:07 -07:00
parent 96bf4872ac
commit b1b7b00d62
4 changed files with 23 additions and 1 deletions
+4 -1
View File
@@ -31,7 +31,10 @@ ZXYStream.prototype._read = function() {
// Prepare sql statement
if (!stream.statement) {
stream.statement = this.source._db.prepare('SELECT zoom_level AS z, tile_column AS x, tile_row AS y FROM ' + this.table, function(err) {
var query = 'SELECT zoom_level AS z, tile_column AS x, tile_row AS y FROM ' + this.table;
if (this.table === 'map') query += ' WHERE tile_id is not null';
stream.statement = this.source._db.prepare(query, function(err) {
if (err && err.code === 'SQLITE_ERROR' && /no such table/.test(err.message)) return stream.push(null);
return stream._read();
});