[gdal-dev] GDALWarpOperation::WarpRegionToBuffer() doesn't write in my buffer

Frank Warmerdam warmerdam at pobox.com
Mon Nov 22 10:34:26 EST 2010


bosow at club-internet.fr wrote:
> No problem. I have re-uploaded a new 
> version: http://bosow.free.fr/bundle.rar
> I compiled it and the same error occurs: ch2d (float* buffer) remains 
> unchanged after WarpRegionToBuffer() call.

Matthieu,

The core problem is that you setup a transformer that goes from pixel/line
coordinates on the source raster to georeferenced coordinates, instead of
going to pixel/line coordinates on the destination raster.

It is a clue that you use GDALSuggestedWarpOutput() to get a geotransform
and pixel size for the output buffer but you never actually make any use of
those values.

One approach is to define your own transformer instead of using
GDALCreateGenImgProjTransformer() that maps between source and
destination buffer pixel/line coordinates using the geotransforms
or perhaps even other mechanisms.

Another approach might be to create a sort of fake output file, based
on the output of GDALSuggestedWarpOutput() and then pass that in to
GDALCreateGenImgProjTransformer() but still pass NULL for the destination
dataset when you setup the psWarpOptions.

I realize using WarpRegionToBuffer() directly is rather complication - but
it was not really intended to be widely used outside of the warp engine
itself.

If you wish to followup feel free to do it by direct email to me.

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