[Gdal-dev] Re: Re: GDALWarp - NO_DATA Replace?

Jason Hughes jason.hughes at elantech-inc.com
Wed Nov 17 18:04:11 EST 2004


Frank - To use pfnPreWarpChunkProcessor do I have to set dfWarpMemoryLimit 
in order to know what the chunk size is to process the chunk myself?  Or is 
there another way to get the chunk size without setting it?

Thanks,
Jason

"Frank Warmerdam" <warmerdam at pobox.com> wrote in message 
news:4194EBCF.6000607 at pobox.com...
> Jason Hughes wrote:
>> 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.
>
> Jason,
>
> Ah yes, I see.  You would like to set a -dstnodata, but you also want to
> slightly alter any input pixels that would match it so they won't be
> seen as nodata at the end.
>
> On the one hand this seems like a very specialized case, but on the other
> I can imagine it coming up fairly often.
>
> There isn't any way of doing this now with gdalwarp.  Normally I would 
> advise
> you to do the remapping as a preprocessing step, and then run gdalwarp.
>
> However, you could also construct your own version of "gdalwarp" that did
> do this for you if performance is of the essence.
>
> There is a hook in the GDALWarpOptions for a pfnPreWarpChunkProcessor 
> function.
> You could install a function that would make one pass over the incoming 
> image
> data and convert all zeros to ones for instance.
>
> Other than that the program could be the same as gdalwarp.
>
> 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