[Gdal-dev] Re: GDALWarp - NO_DATA Replace?
Jason Hughes
jason.hughes at elantech-inc.com
Fri Nov 12 11:37:37 EST 2004
Frank - Basicially I'm redrawing the image pixel by pixel onto a mapsurface.
For example when warping I set the dstnodata = 0. Then I paint this onto
the map skipping pixels of that value. As to not get my image pixels
confused with the background before I warp it I create a copy in which I set
every pixel with that value to +1. I suppose I could also do this with a
4th raster band but sometimes we work with high resolution data over a large
area which would make for an even bigger file and slow my processing time
when rescaling for the different zoom levels.
I was wondering could there be a way to replace my pixel values that match
the background during the warping operation as to not create a third file or
4th raster band. I create the intermediate file so I do not modfiy the
original image.
Thanks,
Jason Hughes
"Frank Warmerdam" <warmerdam at pobox.com> wrote in message
news:41941D7B.5020308 at pobox.com...
> Jason Hughes wrote:
>> Is there anyway to specify a pixel value to replace while warping. I
>> want a way to differentiate between pixels in my image and the background
>> that is created from warping.
>>
>> I'm overlaying NITF's on maps and I would like a way to not paint the
>> background. So as a workaround I'm making an intermediate file to
>> replace the values that equal my background color myself using
>> GDALCreateCopy(). I then make a third file to warp the image. This
>> seems terribly inefficient. Your input is much appreciated.
>
> Jason,
>
> I'm not clear on exactly what you want to accomplish. You can use the
> -dstnodata argument to gdalwarp to specify a pixel value that will be used
> to mark areas on the output image that were never set from a pixel in the
> input image. However, if there were pixels in the input image that had
> that "dstnodata" value already you won't be able to distinguish them.
>
> Another alternative is to add an alpha band which would be marked as
> opaque for pixels copied from the source image, and transparent for pixels
> that were never set during the warp.
>
> Does one of these cases match your needs?
>
> 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