[Gdal-dev] GDALWarp Gif Problems

Chris Portka cportka at newwireless.com
Tue Jan 23 14:35:33 EST 2007


Frank Warmerdam wrote:
> Chris Portka wrote:
>> I can't seem to get GDAL warp to work on a gif image when converting 
>> from one UTM zone to another.  If anyone could give me any help at 
>> all that would be much appreciated.  I've worked on this a long time 
>> and can't find any documentation that shows I'm doing anything 
>> incorrect.  The exception I get is in this part of the GDAL code (my 
>> code follows):
>>
>> int GDALGenImgProjTransform( void *pTransformArg, int bDstToSrc,
>>                             int nPointCount,
>>                             double *padfX, double *padfY, double *padfZ,
>>                             int *panSuccess )
>> {
>>    GDALGenImgProjTransformInfo *psInfo =
>>        (GDALGenImgProjTransformInfo *) pTransformArg;
>>    int   i;
>>    double *padfGeoTransform;
>>    void *pGCPTransformArg;
>>    void *pRPCTransformArg;
>>    void *pTPSTransformArg;
>>    void *pGeoLocTransformArg;
>>
>>    if( bDstToSrc )
>>    {
>>        padfGeoTransform = psInfo->adfDstGeoTransform;
>>        pGCPTransformArg = psInfo->pDstGCPTransformArg;
>>        pRPCTransformArg = NULL;
>>        pTPSTransformArg = NULL;
>>        pGeoLocTransformArg = NULL;
>>    }
>>    else
>>    {
>>        padfGeoTransform = psInfo->adfSrcGeoTransform;
>>        pGCPTransformArg = psInfo->pSrcGCPTransformArg;    
>> <-----EXCEPTION HERE
>
> Chris,
>
> Your code looks ok to me.  It might help to have a gdalinfo report on the
> input file to see if it has GCPs.
>
> But if I where you, I'd examine the psInfo structure very carefully in
> the debugger to see if there is anything peculiar about it.
>
> If you have no luck, feel free to boil this down to a minimal program,
> and submit a bug report with the input file or a small variation that
> demonstrates the problem.
>
> By the way, the GIF format is a "CreateCopy" format so you won't be
> able to do a warp directly to a gif file.  You will need to do it
> to an intermediate file in a randomly writable format, and then
> use CreateCopy() from that to produce the GIF file.  The intermediate
> file could be in memory (using MEM format driver) if you know you
> aren't working with particularly large images.  However, assuming your
> report of where the problem is manifesting is correct, I can't see
> that this has anything to do with your current problem.
>
> Best regards,
Thanks for your feedback.  I think I may have narrowed down the problem, 
but I'm confused on one point that I can't find documentation for.  In 
the warp tutorial there is the following line for getting the suggested 
output:

eErr = GDALSuggestedWarpOutput <http://gdal.org/gdal__alg_8h.html#816819e7495bfce06dbd110f7c57af65>( hSrcDS, 
                                    GDALGenImgProjTransform, hTransformArg, 
                                    adfDstGeoTransform, &nPixels, &nLines );


I understand what all these arguments are except 
GDALGenImgProjTransform, which I believe to be the transformer 
function's signature, but I'm unclear.  Where is this defined?  How does 
this interact or differ from hTransformArg?  I'm pretty sure it is 
something to do with this interaction that is acting funny.  Are there 
alternatives to this such as a GDALReprojectionTransform?  Is there a 
list of all possible alternatives or a way to construct one myself?  Thanks,
Chris



More information about the Gdal-dev mailing list