From 6d50ec366cd5446d4b54d472a75d9ac55497d6c8 Mon Sep 17 00:00:00 2001 From: Christian Schmitt Date: Thu, 20 Dec 2012 13:08:51 +0100 Subject: [PATCH] gdalchop: interpolate nodata pixels before processing. This yields much nicer scenery tiles as terrafit does not have to work with these missing data fields. Tested at LOWI. --- src/Prep/GDALChop/gdalchop.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Prep/GDALChop/gdalchop.cxx b/src/Prep/GDALChop/gdalchop.cxx index abdebeef..cb4b4f54 100644 --- a/src/Prep/GDALChop/gdalchop.cxx +++ b/src/Prep/GDALChop/gdalchop.cxx @@ -247,6 +247,10 @@ void ImageInfo::GetDataChunk(int *buffer, xformData.col_step = colstep; xformData.row_step = rowstep; + // Interpolate nodata pixels in the source band + GDALRasterBand *mask = dataset->GetRasterBand(srcband)->GetMaskBand(); + GDALFillNodata(dataset->GetRasterBand(srcband), mask, 100, 0, 0, NULL, NULL, NULL); + // TODO: check if this image can actually cover part of the chunk /* establish the full source to target transformation */ @@ -255,7 +259,6 @@ void ImageInfo::GetDataChunk(int *buffer, int srcBandNumbers[] = { srcband }; int dstBandNumbers[] = { 1 }; - //double dstNodata = (double)nodata; double srcNodataReal; double srcNodataImag = 0.0; int srcHasNodataValue; @@ -476,7 +479,7 @@ int main(int argc, const char **argv) west = std::min(west, iwest ); } - SG_LOG(SG_GENERAL, SG_INFO, "Complete bounds n=" << north << " s=" << south << " e=" << east << " w=" << west); + SG_LOG(SG_GENERAL, SG_INFO, "Bounds of all datasets: n=" << north << " s=" << south << " e=" << east << " w=" << west); /* * Step 2: If no tiles were specified, go through all tiles contained in