[gdal-dev] (no subject)
Sjur Kolberg
Sjur.A.Kolberg at sintef.no
Thu May 14 17:44:16 EDT 2009
Hello, GDAL list;
Can anyone suggest what prevents the following GDALSuggestedWarpOutput
from calculating an approximate geotransform? The resulting suggested
GeoTransform is just a copy of the original GeoTransform.
Version is GDAL 1.6.0beta1 under Windows XP, I use Visual Studio 2005,
this is a MFC application. poDataset is a 9900 band GRIB 1 data set
from ECMWF. It appears to be read in OK, I can extract
plausible metadata both from the dataset and from each band.
SourceWKT is (CString)
GEOGCS["Coordinate System imported from GRIB file",DATUM["unknown",
SPHEROID["Sphere",6367470,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
SourceWKT is from poDataset->GetProjectionRef()
TargetWKT is (CString)
PROJCS["UTM 32 North (WGS84)",GEOGCS["WGS 84",DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",
0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],AXIS["Lat",NORTH],AXIS["Long",EAST],
AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],
PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],UNIT["Meter",1]]
TargetWKT is from
ogrspatref.SetProjCS(msg); // CString msg is just a name
ogrspatref.SetWellKnownGeogCS( "WGS84" );
if (ogrspatref.SetUTM( zone, i ) != OGRERR_NONE) // zone==32, i==1 for northern hem.
And the code goes:
void *hTransformArg = GDALCreateGenImgProjTransformer(
poDataset, sourceWKT, NULL, targetWKT, FALSE, 0, 1 );
CPLAssert( hTransformArg != NULL );
if (GDALSuggestedWarpOutput(pSrcDS, GDALGenImgProjTransform,
hTransformArg, SugGeoTransform, &nPixels, &nLines ) != CE_None )
throw new GeneralExcpt("GDALSuggestedWarpOutput failed");
No exception is thown or other error, so everything
seems OK, but the resulting SugGeoTransform is:
[0] 4.0000000000000000 double
[1] 0.25000000000000000 double
[2] 0.00000000000000000 double
[3] 65.000000000000000 double
[4] 0.00000000000000000 double
[5] -0.25000000000000000 double
and nPixels, nLines are 33, 45
This happens to be exactly the GeoTransform of poDataSet, in degrees.
I guess I'm missing something obvious, but I've spent some evenings now.
Thanks for any help.
Sjur K :-)
More information about the gdal-dev
mailing list