[gdal-dev] GDAL Arbitrary Warp Problems

Even Rouault even.rouault at mines-paris.org
Tue Jul 15 11:43:30 PDT 2014


Le mardi 15 juillet 2014 20:33:32, Michael Aschenbeck a écrit :
> Hello,
> 
> I'm trying to follow the warp tutorial (http://www.gdal.org/warptut.html)
> to do a general warp.  However, I'm not getting any good results.
> 
> I first recreated the example in the warp tutorial by first implementing
> the bottom portion modified to output an RGB image, then implementing the
> top portion with GDALGenImgProjTransform as written.  This worked fine.
> 
> Second, I tried to create my own, most basic, transformation:
> 
> int identityTransform(void *pTransformerArg,int bDstToSrc, int nPointCount,
> double *x, double *y, double *z, int *panSuccess)
> {
> return 1;
> }
> 
> i.e. it does not modify any coordinates.  So I changed:
> eErr = GDALSuggestedWarpOutput( poDataset, GDALGenImgProjTransform,
> hTransformArg, adfDstGeoTransform, &nPixels, &nLines );
> to:
> GDALTransformerFunc myTransformer = &identityTransform;
> eErr = GDALSuggestedWarpOutput( poDataset, myTransformer, hTransformArg,
> adfDstGeoTransform, &nPixels, &nLines );
> 
> 
> and
> //psWarpOptions->pfnTransformer = GDALGenImgProjTransform;
> to:
>          psWarpOptions->pfnTransformer = myTransformer;
> 
> I expect to get the same image back but all i get is two vertical lines
> with unreasonable georeferenced coordinates.  I'm hoping someone can show
> me where I'm going wrong, or guide me to an example of a custom
> GDALTransformerFunc to use as a template.
> 
> Thank you in advance for any help you can give!

Why not using gdalwarp directly, or re-using its source code ?

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list