getTile method

List<int>? getTile(
  1. TableName tableName,
  2. int tx,
  3. int ty,
  4. int zoom,
)

Get a Tile's image bytes from the database for a given table.

@param tableName the table name to get the image from. @param tx the x tile index. @param ty the y tile index, the osm way. @param zoom the zoom level. @return the tile image bytes.

Implementation

List<int>? getTile(TableName tableName, int tx, int ty, int zoom) {
//     if (tileRowType.equals("tms")) { // if it is not OSM way
  var tmsTileXY = osmTile2TmsTile(tx, ty, zoom);
  ty = tmsTileXY[1];
//     }
  String sql = SELECTQUERY_PRE + tableName.fixedName + SELECTQUERY_POST;
  var res = _sqliteDb.select(sql, [zoom, tx, ty]);
  if (res.length != 0) {
    return res.first.get(COL_TILES_TILE_DATA);
  }
  return null;
}