Even Rouault wrote:
Le Sunday 07 December 2008 21:30:17 Joaquim Luis, vous avez écrit :
Hi,
I have my gdalwarp MEX that works reasonably into converting between
projection systems. And now I would like to have it working to do warping
with GPS, but after hours of struggling with it, I don't advance a bit. The
GCPs are alway ignored.
I do create the GCPs like this
pasGCPs = (GDAL_GCP *) CPLRealloc( pasGCPs, sizeof(GDAL_GCP) * nGCPCount
); GDALInitGCPs( 1, pasGCPs + nGCPCount - 1 );
for (i = 0; i < nGCPCount; i++) {
pasGCPs[i].dfGCPPixel = ptr_d[i];
pasGCPs[i].dfGCPLine = ptr_d[i+nGCPCount];
pasGCPs[i].dfGCPX = ptr_d[i+2*nGCPCount];
pasGCPs[i].dfGCPY = ptr_d[i+3*nGCPCount];
pasGCPs[i].dfGCPZ = 0;
}
Than I set them
GDALSetGCPs( hSrcDS, nGCPCount, pasGCPs, "" )
Why don't you pass pszSrcWKT instead of "" ? But I'm not sure that it's really
your issue as you specify it below.
Rouault,
It makes no difference. I tried everything
and create a transformer
hTransformArg =
GDALCreateGenImgProjTransformer( hSrcDS, pszSrcWKT, NULL,
pszDstWKT,
nGCPCount == 0 ? FALSE : TRUE,
0, 1 );
I think your way of creating hTransformArg is correct when being used by
GDALSuggestedWarpOutput2, but when doing the really warp, you should pass
hDstDS instead of NULL as the third argument. See apps/gdalwarp.cpp
Again, it makes no difference if use NULL or hDstDS. Besides, I use null because
on an older version of gdalwarp upon which my MEX is based there was this
comment
/* Create a transformer that maps from source pixel/line coordinates
to destination georeferenced coordinates (not destination pixel line)
We do that by omitting the destination dataset handle (setting it to
NULL). */
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev