Hello,
I'm encoutering a little problem, and I cannot figure out where it comes from.
Actually, it seems that some times, the tile is not generated correctly, and either it is empty (white tile, while my backgroundcolor is white) or it contains another part of the part (tile with false coordinates). That's a little hard to explain by writting, so I joined screenshots.
I'm looking to this problem since a little time now, but because this appens only some times, and not always at the same coordinates, It's a bit difficult to reproduce and to understand why I get this error.
I use a server BitmapTileCache and a client BitmapTileCache. PreviewTileCache and Multithreading are activated too. The server use big GeoTiff files to generate 128x128 tiles and send a background picture to the client.
When I empty the ClientCache and restart my application, the picture is correct. But then I have some incorrect data in others places (where it was correct before deleting client caches).
When I deactivate the client cache and the preview cache, but not the server cache, I stilt have those problems.
When I deactivate server cache and use Client cache, I don't have any problem
When I deactivate both client and server cache, I don't have any problem.
I figures out that the problem probably comes either from my own algorithm, server side, that read each tile for an area, and paste them together to send the picture size asked by client, other from the way cached tiles are saved server side.
Here is the code I used to paste the tiles together server side :
var data = bitmapCache.GetTiles(parameter.BoundingBox);
var range = matrix.GetIntersectingRowColumnRange(parameter.BoundingBox);
// parameter contains data requested within the URL
var bmp = new Bitmap(parameter.Width, parameter.Height);
var g = Graphics.FromImage(bmp);
foreach (BitmapTile tile in data)
{
long row = matrix.GetRowIndex(tile.BoundingBox.UpperLeftPoint); // Cached foldername
if (row == range.MinRowIndex)
{
// I don't know why, but the range contains too much tiles, and this is a problem for generating bitmap.
// We don't need the first row and the last column in cache.
continue;
}
long col = matrix.GetColumnIndex(tile.BoundingBox.UpperLeftPoint); // Cached filename
if (col == range.MaxColumnIndex)
{
// Same problem here.
// we don't need the last column index
continue;
}
int x = (int)((col - range.MinColumnIndex) * TileWidth);
int y = (int)((row - range.MinRowIndex - 1) * TileHeight);
g.DrawImage(tile.Bitmap, x, y);
}
I figured as well that server and client cache save not the picture the same way, although I used the same FileBitmapTileCache. The server saves always ont row and one column more than client side (see my comments in the code above), so when I read the tiles, I must not read the first column and row for pictures.
Ok, that's all for the moment, I hope that my explanations where fait enough, and my english not too bad :-)
Do you have some advices to help me solving this issue ?
Thanks,
Guillaume.