[Gdal-dev] Corrupted WKT in my GeoTIFF dem

Michael Logan mlogan at mail.arc.nasa.gov
Fri Jul 30 16:30:13 EDT 2004


Hello,

I am trying to create a Geotiff DEM from scratch during conversion
 from GridFloat format (i've tried multple formats (int16,float32,byte)),
 but while everything seems good, the WKT is always clobbered.

I set the WKT in my C++ code, but after closing the file and exiting,
 a gdalinfo gives "badness" for the projection portion:

------
% gdalinfo area79.tiff
Driver: GTiff/GeoTIFF
Size is 21600, 7200
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 7200.0)
Upper Right (21600.0,    0.0)
Lower Right (21600.0, 7200.0)
Center      (10800.0, 3600.0)
Band 1 Block=21600x1 Type=Int16, ColorInterp=Gray
-----

So, my corners don't appear as Geographics corners
 as I'd hoped, since it appears no info is available
 to do the transform..

Here is my code for setting the projection:
------
    oSRS.SetGeogCS( "WGS84","WGS_1984", "WGS 84",
            6378137.0,   298.2572235629972,
            "Greenwich",  0.0,  "degree",
            0.0174532925199433 );

    char *pszSRS_WKT = NULL;

    oSRS.exportToWkt( &pszSRS_WKT );
    cout << "WKT = " << endl << pszSRS_WKT << endl;
    if( geoDataset->SetProjection( pszSRS_WKT ) == CE_Failure )
      cerr << "Failed to write projection to dataset" << endl;
------

and the "COUT" does do something correctly:

----
WKT =
GEOGCS["WGS84",DATUM["WGS_1984",SPHEROID["WGS84",6378137,298.2572235629972]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
-----

AND, right before I exit, I do a

    cout << "Final request for projection string = " << endl
     << geoDataset->GetProjectionRef() << endl;

and it still seems ok....
---
Final request for projection string =
GEOGCS["WGS84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.2572235629972]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
---

any ideas??

Thanks,
ml

-- 
Michael Logan (650)-604-4494 QSS Group,Inc./NASA Ames Research Center
Task Lead, Visual Cueing & Simulation
Task Lead, Dynamic Aircraft Reconfiguration & Damage Adaptive Control
MS 262-6,Moffett Field, CA, 94035





More information about the Gdal-dev mailing list