[Gdal-dev] GDALWarpOptions - Destination dataset issue

Frank Warmerdam warmerdam at pobox.com
Wed Nov 22 10:25:10 EST 2006


Guillaume Bourel wrote:
> Hi,
> 
> I am currently trying to warp GeoTiff data with any geographic 
> coordinate system into WGS84 with Mercator projection, within a C++ 
> project.
> 
> I do believe this should be done by using GDALWarpRegionToBuffer, which 
> needs a GDALWarpOperation, which, itself, needs a GDALWarpOptions.
> 
> 
> GDALWarpOptions reference explains :
> 
>    GDALDatasetH GDALWarpOptions::hDstDS
>    <http://gdal.maptools.org/structGDALWarpOptions.html#o5>
>    Destination image dataset - may be NULL if only using
>    GDALWarpOperation::WarpRegionToBuffer()
>    <http://gdal.maptools.org/classGDALWarpOperation.html#a7>.
> 
> but GDALWarpOperation::Initialize or GDALCreateWarpOperation both 
> returns CE_Failure, if hDstDS is set to NULL
> (behavior due to ValidateOptions() call, which checks hDstDS isn't 
> NULL). Therefore, creation of the GDALWarpOperation fails.
> And, as I don't have any destination file, my destination dataset is NULL.
> 
> I don't understand what I'm doing wrong,
> if someone could explain me the way I should follow to successfully 
> create a GDALWarpOperation in order to use it with GDALWarpRegionToBuffer.

Guillaume,

It appears that support for null hDstDS has "rotted" through disuse.  I
have made a few changes to the Validate() method that I hope will fix the
problem, but I currently have no uses for this style of use of the warper
so it is hard for me to check.  Can you grab the latest from CVS and
see if this helps?

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list