本文整理汇总了C#中OSGeo.GDAL.Dataset.FlushCache方法的典型用法代码示例。如果您正苦于以下问题:C# Dataset.FlushCache方法的具体用法?C# Dataset.FlushCache怎么用?C# Dataset.FlushCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSGeo.GDAL.Dataset
的用法示例。
在下文中一共展示了Dataset.FlushCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRasterBlocks
private static void ReadRasterBlocks(ref Dataset valueRaster, ref Dataset zoneRaster)
{
_rasInfoDict = new Dictionary<int, StatisticsInfo>[valueRaster.RasterCount];
int valueRasterBandCount = valueRaster.RasterCount;
int rasterRows = zoneRaster.RasterYSize;
int rasterCols = zoneRaster.RasterXSize;
const int blockSize = AppUtils.GdalUtilConstants.RasterBlockSize;
for (int rasBand = 0; rasBand < valueRasterBandCount; rasBand++)
{
Band bandValueRaster = valueRaster.GetRasterBand(rasBand + 1);
Band bandZoneRaster = zoneRaster.GetRasterBand(1);
_rasInfoDict[rasBand] = new Dictionary<int, StatisticsInfo>();
for (int row = 0; row < rasterRows; row += blockSize)
{
int rowProcess;
if (row + blockSize < rasterRows)
{
rowProcess = blockSize;
}
else
{
rowProcess = rasterRows - row;
}
for (int col = 0; col < rasterCols; col += blockSize)
{
int colProcess;
if (col + blockSize < rasterCols)
{
colProcess = blockSize;
}
else
{
colProcess = rasterCols - col;
}
double[] valueRasterValues = new double[rowProcess * colProcess];
double[] zoneRasterValues = new double[rowProcess * colProcess];
bandValueRaster.ReadRaster(col, row, colProcess, rowProcess, valueRasterValues, colProcess, rowProcess, 0, 0);
bandZoneRaster.ReadRaster(col, row, colProcess, rowProcess, zoneRasterValues, colProcess, rowProcess, 0, 0);
ProcessEachRasterBlock(valueRasterValues, zoneRasterValues, rasBand, ref _rasInfoDict);
}
}
}
//flush rasters cache
valueRaster.FlushCache();
zoneRaster.FlushCache();
valueRaster.Dispose();
zoneRaster.Dispose();
StatisticsExport writer = new StatisticsExport(_zoneFile);
writer.ExportZonalStatistics(ref _rasInfoDict, _cellSize);
}