[gdal-dev] FillNodata and source NoDatas

Frank Warmerdam warmerdam at pobox.com
Thu Apr 15 12:24:57 EDT 2010


Jose Gomez-Dans wrote:
> Hi,
> I want to use FillNodata to fill some missing data in a raster file 
> (obviously!). However, in my source data file some of the NoData mean 
> just "NoData", and I want the algorithm to ignore those values. Does 
> this method ignore the missing values when it bags the values to 
> interpolate the output?
> 
> Basically, my raster looks like a black square with some "island blobs" 
> where I have data. Some pixels in those blobs are flagged as unsuitable 
> (using a mask band), and I would like to interpolate these unsuitable 
> values. However, I want to make sure that the background NoData pixels 
> in my original raster will be ignored.
> 
> Looking at the code in rasterfill.cpp I don't think this isn't the case: 
> the mask band is the optional mask band , or the target's internal mask 
> band.
> 
> I've put together what I think is a patch to solve this, but I can't 
> quite test it yet (I still need to get my data into shape!). Am I 
> totally barking at the wrong tree? I'll file a report if this is not 
> just my misunderstanding.

Jose,

Normally the raster fill algorithm uses the mask to identify pixels to
be replaced, and it ignores the values of the pixels to be replaced.  Often
the pixels to replaced are all nodata and everything else is valid.

As I understand, the region you want to replace is a subset of all the
nodata pixels, but you still want to ensure that nodata pixels which
are not being replaced are not included in the interpolation.  Is that
correct?

I can't entirely follow how the patch will work but it seems to be
doing essentially a reasonable thing.   I am unfortunately hesitant to
alter the GDALFillNodata() API at this point so I'm not sure your patch will
make it back into the core. But once you have used it, I'd appreciate your
submitting it as a ticket in case others need it.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list