lundi 23 novembre 2015

reading tile-data from mbtiles generates "RangeError: Error #2006: The supplied index is out of bounds."

I am trying to read imagedata from a sqlite database ( it is a mbtiles map tiles file ) for that i tried to convert this php code

$sql = "SELECT * FROM tiles WHERE zoom_level = $zoom AND tile_column = $column AND tile_row = $row";
$q = $conn->prepare($sql);

$q->bindColumn(1, $zoom_level);
$q->bindColumn(2, $tile_column);
$q->bindColumn(3, $tile_row);
$q->bindColumn(4, $tile_data, PDO::PARAM_LOB);

header("Content-Type: image/png");
echo $tile_data;

to as3 using

        _conn = new SQLConnection();
        _conn.addEventListener(SQLEvent.OPEN, openHandler); 
        _conn.addEventListener(SQLErrorEvent.ERROR, errorHandler); 
        var folder:File = File.applicationDirectory; 
        var dbFile:File = folder.resolvePath("test.mbtiles");
        _conn.openAsync(dbFile, SQLMode.READ);
        function openHandler(event:SQLEvent):void 
        trace("db opened"); 
        var selectStmt:SQLStatement = new SQLStatement(); 
        selectStmt.sqlConnection = _conn; 
        selectStmt.text = "SELECT * FROM tiles WHERE zoom_level = 5 AND tile_column = 17 AND tile_row = 20"; 

but i am getting "RangeError: Error #2006: The supplied index is out of bounds."

Any ideas on how to solve this? Thanks!

Aucun commentaire:

Enregistrer un commentaire