Skip to content

Commit 0276794

Browse files
committed
fix issue with really large tile tables
1 parent 887687f commit 0276794

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/geoPackage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export class GeoPackage {
301301
const tm = tileMatrixDao.createObject(result);
302302
// verify first that there are actual tiles at this zoom level due to QGIS doing weird things and
303303
// creating tile matrix entries for zoom levels that have no tiles
304-
if (tileMatrixDao.tileCount(tm)) {
304+
if (tileMatrixDao.hasTiles(tm)) {
305305
tileMatrices.push(tm);
306306
}
307307
});

lib/tiles/matrix/tileMatrixDao.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,10 @@ export class TileMatrixDao extends Dao<TileMatrix> {
7373
const result = this.connection.get(query, whereArgs);
7474
return result?.count;
7575
}
76+
hasTiles(tileMatrix: TileMatrix): boolean {
77+
const where = this.buildWhereWithFieldAndValue(TileColumn.COLUMN_ZOOM_LEVEL, tileMatrix.zoom_level);
78+
const whereArgs = this.buildWhereArgs([tileMatrix.zoom_level]);
79+
const query = SqliteQueryBuilder.buildQuery(false, tileMatrix.table_name, undefined, where);
80+
return this.connection.get(query, whereArgs) != null;
81+
}
7682
}

0 commit comments

Comments
 (0)